![]() |
MySQL4 compatible imports into v5...
I'm trying to write an installer script, but when it comes down to the actual "drop if exists" statements it dies on the following line. I have MySQL 5.0.50 and the SQL export (that I'm importing with the script) is in MySQL40 compatibility mode.
Can anyone tell me why a simple statement like the following is dying with the given error? When I import this script by phpMyAdmin, I get to specify MySQL40 compatibility mode though, this whole thing works. sql Code:
Quote:
|
That's a strange one to say the least. The good news is that I can replicate the problem using your export here running MySQL 5.0.45 so I'll play about some more and let you know if I can get it working.
Alan. |
Okay thanks, it's really a strange one. :-@ I'm just doing a "file_get_contents" and running it as my query, in case that method is bad.
Maybe I should format it differently, and do one statement at a time? |
Problem solved - turns out that mysql_query() doesn't support multiple queries (PHP: mysql_query - Manual - "mysql_query() sends an unique query (multiple queries are not supported) to the currently active database..."). The MySQL C API supports a flag to allow multiple queries but I couldn't find one for PHP.
Supposedly some sort of security measure to prevent SQL injection :/ A workaround could be to explode the big query by ';' and run them seperately perhaps. Alan. |
...ugh. I had worried about that. I don't have mysqli available on my server either, which is slightly odd. Thanks for all your help Alan.
|
Before you go about installing mysqli, that doesn't support it either :/
And np's - glad I found this out myself, I'd always assumed it could handle multiple queries. Alan. |
I thought I heard mysqli did! *!* So much for that hope.
Looks like I might have to write my own "multi-query" member for my database. At the moment this work around is successful, though there isn't any aggregation of the results. PHP Code:
|
Quote:
|
Ahh, good call - dammed if I saw that originally :-)
Alan. |
| All times are GMT. The time now is 09:33 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0