Preventing SQL Injection in dynamical SQL [duplicate]
问题 This question already has answers here : How can I prevent SQL injection in PHP? (28 answers) Closed 5 years ago . I am forced to generate dynamic SQL. I realize it greatly complicates matters to do so, and the below example is silly and obviously does not require dynamic SQL, and is just used to illustrate this question. Escaping user provided data is not enough, and the 3rd query in the below script is suspect to SQL Injection. I have found that it is generally easiest to design the