webdev007
Programmer
- Sep 9, 2005
- 168
I am putting together a one-size-fits-all function
could you give it a look and let me know about possible errors/flaws/mistake
thank you
function CleanDb($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
else
if (is_numeric($value))
{
$value=$value;
}
// if not a number or a numeric string
else
{
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}
could you give it a look and let me know about possible errors/flaws/mistake
thank you
function CleanDb($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
else
if (is_numeric($value))
{
$value=$value;
}
// if not a number or a numeric string
else
{
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}