diff --git a/safemysql.class.php b/safemysql.class.php index 4a2ed2a..5dc1cb1 100644 --- a/safemysql.class.php +++ b/safemysql.class.php @@ -470,23 +470,28 @@ class SafeMySQL private function escapeInt($value) { - if (is_float($value)) - { - $value = number_format($value, 0, '.', ''); // may lose precision on big numbers - } - elseif(is_numeric($value)) + if ($value === NULL) { - $value = $value; + return 'NULL'; } - else + if(!is_numeric($value)) { $this->error("Integer (?i) placeholder expects numeric value, ".gettype($value)." given"); + return FALSE; } - return " ".$value; // to avoid double munus collision (one from query + one from value = comment --) + if (is_float($value)) + { + $value = number_format($value, 0, '.', ''); // may lose precision on big numbers + } + return $value; } private function escapeString($value) { + if ($value === NULL) + { + return 'NULL'; + } return "'".mysqli_real_escape_string($this->conn,$value)."'"; }