I’m learning how to sanitize my forms and know that using the PHP function mysql_real_escape_string() helps escape characters that are consider “dangerous” or will break the syntax of your SQL. I was testing it out and noticed that it doesn’t escape character sequences such as -- or /* */. Aren’t these comments in SQL and couldn’t they break the syntax of a statement? How would you hand these and other items that mysql_real_escape_string() does not cover and really sanitize your forms?
I’m learning how to sanitize my forms and know that using the PHP function
Share
They will never break a SQL statement as they will never break out of a string, and therefore your string remains intact, protecting you from any nasty injections.
That does not mean you don’t want to remove them from the string however. From a MySQL point of view they are safe, but depending on your application that may not be the case.