Another group of ignorant answers. Kamran, you attract him like a magnet.
You should understand that mysql_real_escape_string has nothing to do with forms and radio stations, with verification and disinfection.
And this does not prevent attacks.
This is just a string escaping function. It avoids the data that will be inserted into the SQL query string as string data.
SQL query is a small program. With its own syntax. You should follow this syntax, not because of “attacks”, but because of this, just the syntax. And, of course, these rules are independent of the data source! Radio button, html form or browser - all this does not matter!
And it only works with strings. Not with numbers and identifiers.
Here is my answer on how to process the SQL query: In PHP, when sending rows to the database should you take care of invalid characters using htmlspecialchars () or use a regular expression?
source share