How do parameterized queries help against SQL injection?

后端 未结 6 1490
有刺的猬
有刺的猬 2020-11-21 22:32

In both queries 1 and 2, the text from the textbox is inserted into the database. What\'s the significance of the parameterized query here?

  1. Passing tx

6条回答
  •  余生分开走
    2020-11-21 23:24

    Parameterized queries do proper substitution of arguments prior to running the SQL query. It completely removes the possibility of "dirty" input changing the meaning of your query. That is, if the input contains SQL, it can't become part of what is executed becase the SQL is never injected into the resulting statement.

提交回复
热议问题