Had a fun time trying to get that snippet to come out right, this site's character conversions are wreaking havoc on my code. The &'s above should be actual ampersand characters.
Use the download link to ensure that the code you are using contains the correct characters. If you just copy and paste, you run into trouble with the word wrap and character escaping.
function quote_smart($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;
}