Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Invalid parameter number: number of bound variables does not match number of tokens

I am getting this error:

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

from teh following code

$check = Answers::findFirst(array(
  'conditons' => 'uuid = ?1 AND question = ?2 AND type = ?3',
  'bind' => array(
    1 => $data['uuid'],
    2 => $data['question'],
    3 => 'text'
)));


7.0k
Accepted
answer
edited Feb '16

This code works. not sure why the destincting in the syntax makes it work properly but seems pretty odd to me. Dropping the 'conditions' key to teh associative array magically fixed it.

$check = Answers::findFirst(array(
  'uuid = ?1 AND question = ?2 AND type = ?3',
  'bind' => array(
    1 => $data['uuid'],
    2 => $data['question'],
    3 => 'text'
  )));


5.9k

Because you wrote "conditons" and it should be "conditions" :)

OMG i swear i looked at that word like 12 times... Dislexia moment :P