diff --git a/include.mysql.php b/include.mysql.php index e84a556..b5939a9 100644 --- a/include.mysql.php +++ b/include.mysql.php @@ -59,7 +59,7 @@ class CachedPDO extends PDO { $type = $this->GuessType($value); - if(is_numeric($value) && $type == PDO::PARAM_STR) + if(preg_match("/^[0-9]+$/", $value) && $type == PDO::PARAM_STR) { /* PDO library apparently thinks it's part of a strongly typed language and doesn't do any typecasting. * We'll do it ourselves then. */ @@ -67,6 +67,11 @@ class CachedPDO extends PDO $type = PDO::PARAM_INT; } + if($type == PDO::PARAM_STR) + { + $value = strval($value); + } + $statement->bindValue($key, $value, $type); } }