Page 1 of 1
[MySQL] Mixed named and positional parameters
Posted: Sat Jun 14, 2008 2:55 am
by nutkenz
QUERY:
Code: Select all
SELECT * FROM feed_products WHERE feed_id=21 AND name='L\'Oblique AZO verticale hangmap gekleurd'
Raw version (notice that the quote is escaped, which is why it's blue in the code view above): SELECT * FROM feed_products WHERE feed_id=21 AND name='L\'Oblique AZO verticale hangmap gekleurd'
ERROR:
SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters
What does this mean? I couldn't find a decent explanation anywhere
Re: [MySQL] Mixed named and positional parameters
Posted: Sat Jun 14, 2008 4:07 am
by Benjamin
Your not escaping the data with mysql_real_escape_string.
They query below should work because there is a \ in front of the '.
Code: Select all
SELECT * FROM feed_products WHERE feed_id=21 AND name='L\'Oblique AZO verticale hangmap gekleurd'
EDIT, which doesn't show up in code view:
SELECT * FROM feed_products WHERE feed_id=21 AND name='L\'Oblique AZO verticale hangmap gekleurd'
Re: [MySQL] Mixed named and positional parameters
Posted: Sat Jun 14, 2008 4:14 am
by nutkenz
You're right, it doesn't show up in code view; the string is already escaped:
SELECT * FROM feed_products WHERE feed_id=21 AND name='L\'Oblique AZO verticale hangmap gekleurd'
Re: [MySQL] Mixed named and positional parameters
Posted: Sat Jun 14, 2008 4:16 am
by Benjamin
Are you calling the query with mysql_query?
Re: [MySQL] Mixed named and positional parameters
Posted: Sat Jun 14, 2008 4:26 am
by nutkenz
No, I'm using Zend DB with the PDO MySQL adapter
Re: [MySQL] Mixed named and positional parameters
Posted: Sat Jun 14, 2008 4:31 am
by Benjamin
I'm not familiar with that, but I did find a link. Search google using that error code.
http://framework.zend.com/issues/browse/ZF-159