mysql报错解决:[HY093]

-----Invalid parameter number: parameter was not defined ----

SELECT id WHERE x = ?, y = ?, z = ?

Might produce the Log: Invalid parameter number: parameter was not defined with params ("x","y","z")

This looks like it shouldn't be throwing an error, but if the indexes are something like:

0 => x, 1 => y, 4 => z

解决: array_values($arr); //重新排列一下数组的key,变成有序

你可能感兴趣的:(mysql报错解决:[HY093])