When using PDO, do i still need to addslashes or is this done already with PDO?
If it’s already done, then do is there any other sanitizing i should do before inserting data to a table?
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.
No, you definitely do not need
addslashesif you’re usingPDOStatementproperly. You don’t need additional sanitization to prevent SQL injection. However, you may still want to validate in other ways. For example, you might check that an email field “looked like” an email address, or make sure that a plain text field did not contain certain characters. Finally, you may have to escape (e.g. withhtmlspecialchars) when you output text from the database.