We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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'
)));


18.5k
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'
  )));


12.2k

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

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