避開insert into mysql特殊符號的問題

function gb($str){//deal with the uploaded data!
 $str = str_replace("and","and",$str);
 $str = str_replace("execute","execute",$str);
 $str = str_replace("update","update",$str);
 $str = str_replace("count","count",$str);
 $str = str_replace("chr","chr",$str);
 $str = str_replace("mid","mid",$str);
 $str = str_replace("master","master",$str);
 $str = str_replace("truncate","truncate",$str);
 $str = str_replace("char","char",$str);
 $str = str_replace("declare","declare",$str);
 $str = str_replace("select","select",$str);
 $str = str_replace("create","create",$str);
 $str = str_replace("delete","delete",$str);
 $str = str_replace("insert","insert",$str);
 $str = str_replace("'","'",$str);
 $str = str_replace("\"",""",$str);
 return  $str;

避掉存入mysql可能的特殊符號轉換函式

Previous
Next Post »