diff --git a/E_PDOStatement.php b/E_PDOStatement.php index 8540bdd..87d331f 100644 --- a/E_PDOStatement.php +++ b/E_PDOStatement.php @@ -114,10 +114,15 @@ public function interpolateQuery($inputParams = null) */ if (is_array($inputParams) && $inputParams !== array()) { - foreach ($inputParams as $replValue) + ksort($inputParams); + foreach ($inputParams as $key => $replValue) { - $replValue = $this->_prepareValue($replValue); - $testQuery = preg_replace("/\?/", $replValue, $testQuery, 1); + $key = (is_numeric($key)) ? "\?" : $key; + + $testParam = "/" . $key . "/"; + $replValue = $this->_prepareValue($replValue); + + $testQuery = preg_replace($testParam, $replValue, $testQuery, 1); } }