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?
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?
No, you definitely do not need addslashes
if you're using PDOStatement
properly. 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. with htmlspecialchars
) when you output text from the database.