Possible Duplicate:
Are dynamic mysql queries with sql escaping just as secure as prepared statements?
Is using only mysqli_real_escape_string enough to secure a query? Or is there more to consider when trying to securely query a database?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
If used everywhere correctly real_escape_string is an option. But consider the following code:
Safe or not? real_escape_string can only be used to escape strings inside quotation marks.
$pagecould be1 OR id IN (2,3,4,5,6,7,8,9)→ no quotation marks, no real escaping. Casting to the correct datatype (int) might help in this case. You’re better off using prepared statements, they are not as easily to mis-use.