Per evitare SQL injection potrebbe esser utile purificare le stringhe ottenute tramite un form:
function str2db($input, $strip_tags=true) { if(is_array($input)) { foreach($input as $key => $value) { $input[$key] = str2db($value); } } else { if(get_magic_quotes_gpc()) { if(ini_get('magic_quotes_sybase')){ $input = str_replace("''", "'", $input); } else { $input = stripslashes($input); } } if($strip_tags) { $input = strip_tags($input); } $input = mysql_real_escape_string($input); $input = trim($input); } return $input; }