Forum Moderators: coopster
function cleanDB($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}
foreach($_POST as &$value){
$value = cleanDB($value);
}
print_r($_POST);
I keep getting an error at the foreach statement saying the '&' is unexpected and it was expecting a '$' but the PHP manual for 'foreach' has the same code. Is there something else going on here?
--Nick