I want to protect my web app from SQL_Injection. Here's the function I wrote but I want your opinion about it and if you have any tips to improve it! Thank you in advance!
function charfilter($String)
{ /*Sanitize input*/
$count=0;
$forbidden= array("'",";","--","=","\"","#","<",">");
$String=str_replace($forbidden," ", $String,$count);
// String lenght limited to MAX_BUFF
return substr($String,0,MAX_BUFF);
}