Possible Duplicate:
Best way to prevent SQL injection in PHP?
I'm still using mysql_
ext in an old project, so mysql_real_escape_string()
is enough to prevent sql injection ? Or I have to use expressions
?
Possible Duplicate:
Best way to prevent SQL injection in PHP?
I'm still using mysql_
ext in an old project, so mysql_real_escape_string()
is enough to prevent sql injection ? Or I have to use expressions
?
This depends on what you're trying to reference. You wouldn't typically use mysql_real_escape_string
if the value was an int
or double
. However, if it's a string (and you pay attention when you insert data that could have been manipulated by someone other than you) you should be safe.
PDO isn't the end-all to injection, but it does make things a lot simpler. But, mysql_*
has been used successfully for years and doesn't make a site any less secure (just depends on who wrote the site).