I have a 2 part query which works fine when I paste it into phpMyAdmin, but when I go to use it in PHP, it error's after the semi-colon between the commands.
The MySQL server doesn't process statement batches; it only recognises single statements without terminating semicolons.
However, some client programs, like the mysql client, and apparently phpMyAdmin as you point out, accept statement batches, which they parse into individual statements and send individually to the server.
I don't know much about PHP, but I'd be surprised if its MySQL interface accepted statement batches. It looks like you would have to break it up into 2 separate queries, without semicolons.
I discovered, PHP will allow you to run the queries one after the other; this worked in my case where I was loading a variable, and then using that variable in an insert.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.