pls help me fix sql error

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
adex3g
Forum Newbie
Posts: 3
Joined: Mon Mar 03, 2014 11:23 pm

pls help me fix sql error

Post 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"));
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: pls help me fix sql error

Post 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.
(#10850)
adex3g
Forum Newbie
Posts: 3
Joined: Mon Mar 03, 2014 11:23 pm

Re: pls help me fix sql error

Post by adex3g »

My using PDO
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: pls help me fix sql error

Post by Christopher »

So does AOG_single() pass the array of parameters correctly to PDO?
(#10850)
adex3g
Forum Newbie
Posts: 3
Joined: Mon Mar 03, 2014 11:23 pm

Re: pls help me fix sql error

Post by adex3g »

Yes it pass parameter correctly
Post Reply