Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8241117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:43:36+00:00 2026-06-07T20:43:36+00:00

Using parameters instead of placing values directly in the query string is done to

  • 0

Using parameters instead of placing values directly in the query string is done to prevent SQL injection attacks and should always be done:

... WHERE p.name > :name ...
->setParameter('name', 'edouardo')

Does this mean that if we use parameters like this, we will always be protected against SQL injections? While using a form (registration form of FOS), I put <b>eduardo</b> instead and this was persisted to the database with the tags. I don’t really understand why using parameters is preventing against SQL injections…

Why are the tags persisted to the database like this? Is there a way to remove the tags by using Symfony’s validation component?

Is there a general tip or method that we should be using before persisting data in the database in Symfony?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:43:37+00:00Added an answer on June 7, 2026 at 8:43 pm

    Start with reading on what’s SQL injection.

    SQL injection attack takes place when value put into the SQL alters the query. As a result the query performs something else that it was intended to perform.

    Example would be using edouardo’ OR ‘1’=’1 as a value which would result in:

    WHERE p.name > 'edouardo' OR '1'='1'
    

    (so the condition is always true).

    “<b>eduardo</b>” is a completely valid value. In some cases you will want to save it as submited (for example content management system). Of course it could break your HTML when you take it from the database and output directly. This should be solved by your templating engine (twig will automatically escape it).

    If you want process data before passing it from a form to your entity use data transformers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I rewrite this so that it is using parameters instead of string
I'm trying to parse parameters from a query string using this jquery plugin and
I want to hide parameters from URL. I'm using uuids instead of ids and
I'm tracking Hibernate's generated SQL statements and their bound parameters using log4j on a
How to call function using parameters in powershell with parenthesis. I have as example
I am writing a program in C# that runs some select statements using parameters
Why would we set ServletContext parameters using the setAttribute() method, as we can accomplish
How to document methods with parameters using Python's documentation strings? PEP 257 gives this
How to call a function which takes two parameters using threading in C#? I
I know I can retrieve some settings.xml parameters using properties, like, for example ${settings.localRepository}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.