Just bump into the issue that I can't execute multiple sql queries using the $wpdb->query(). Generated queries work fine directly in phpmyadmin so its something will the ezSQL class only. By design perhaps?

I found this http://wordpress.org/support/topic/wpdb-gtquery-fails-when-multiple-update-statements-are-used which also says its by design. Can anyone confirm? ezSQL docs dont say anything about multiple queries support.

If you have to do a bunch of queries mainly (INSERT/UPDATE/DELETE), any better way of doing them other than doing them one by one using $wpdb->insert() and like functions?

link|improve this question

67% accept rate
Interesting question, can you edit it and include a code example? This will teach more users about multiple statements in one query. Does it help to use transactions here? – Jan Fabry Apr 26 '11 at 7:04
What's the issue with doing them one by one? – AlxVallejo Mar 6 at 15:46
feedback

1 Answer

up vote 0 down vote accepted

Using PHP 5.3.5, I was unable to make this syntax work even after setting the 5th parameter of mysql_connect() to 65536 (CLIENT_MULTI_STATEMENTS). Looks like it's not possible to concatenate multiple queries into one statement as long as the old-school MySQL API is running the show.

I assume you're familiar with the MySQL multiple row INSERT syntax, but I mention it just in case.

link|improve this answer
Thanks for checking, looks like its mysql's fault then and not of ezSQL. Yes, I am using multiple row syntax for inserts now. I will just wait for sometime in case someone stops by and add something here before accepting your answer. – Ashfame Apr 25 '11 at 21:43
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.