Page 1 of 1

pls help me fix sql error

Posted: Tue Mar 04, 2014 2:53 am
by adex3g
Time : 08:52:05
SQLSTATE[HY093]: Invalid parameter number
Raw SQL : SELECT COUNT(*) FROM `AOG_friends` WHERE ((`A_mid` = :id AND `A_to` = :to) OR (`A_mid` = :to AND `A_to` = :id)) AND `A_accepted` = 'yes'
Added after 3 minutes:
Real codes/script part
$AOG_re = $this->AOG_db->AOG_single("SELECT COUNT(*) FROM `AOG_friends` WHERE ((`A_mid` = :id AND `A_to` = :to) OR (`A_mid` = :to AND `A_to` = :id)) AND `A_accepted` = 'yes'", array('id'=>"$AOG_mid", 'to'=>"$AOG_to"));

Re: pls help me fix sql error

Posted: Tue Mar 04, 2014 10:06 am
by Christopher
What database extension are you using? I suspect that :id and :to are not being set correctly, but I don't know what $this->AOG_db->AOG_single() does.

Re: pls help me fix sql error

Posted: Tue Mar 04, 2014 1:28 pm
by adex3g
My using PDO

Re: pls help me fix sql error

Posted: Tue Mar 04, 2014 2:26 pm
by Christopher
So does AOG_single() pass the array of parameters correctly to PDO?

Re: pls help me fix sql error

Posted: Tue Mar 04, 2014 5:40 pm
by adex3g
Yes it pass parameter correctly