Simple question: how can I protect so that when the user inputs "union select" in a field and then sends it as a parameter to a query mysql won't give an error.
Should I simply check if "union select" is inputed or there are also other keywords that could result in a mysql error?
Here's the SQL protection function I use now:
function sql_protect(&$n){ 
  $n=stripslashes($n);
  $n=mysql_real_escape_string($n);
  $dntwant = array("\'","\\", "/","\"",")","(","<",">","\\r\\n",";","*","%");
  $n = str_replace($dntwant,"", $n);
}
The query has something similar in it:
where column1 like '%$user_input%'
 
     
     
    