Jump to content

does mysql_real_escape_string always prevent SQL injection


zander1983

Recommended Posts

mysql_real_escape_string only protects against sql injection in string data, i.e. data enclosed by single-quotes in a query.

 

For things like numerical data (which is not enclosed by single-quotes in a query), you need to validate/cast the data as a number in order to prevent sql injection, because it is possible to form sql that contains no quotes for which escaping the quotes doesn't do anything because there are no quotes to escape.

For things like numerical data (which is not enclosed by single-quotes in a query), you need to validate/cast the data as a number in order to prevent sql injection, because it is possible to form sql that contains no quotes for which escaping the quotes doesn't do anything because there are no quotes to escape

 

i had not thought about that, this must be the problem, cheers

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.