What is the SQL syntax to import an sql file through PHP? I am using ADOdb and my user has the FILE privaledge (at least i think that is what is needed).
That works for now thanks. Only thing is, it doesn't if there is more than one SQL query in the file, but in my case, there isn't. I just thought there was a way to read an SQL file from SQL, Like LOAD DATA INFILE, but that is only for like comma delimited files I guess. I'm not sure how phpMyAdmin does it, but I thought it would be easier to ask rather than dig through their code. Thanks.
You can use a LOAD DATA INFILE query if you wanted to, I was under the impression the sql file you wanted to load just contained some query and not data, my mistake:
Pyrite wrote:Only thing is, it doesn't if there is more than one SQL query in the file, but in my case, there isn't.
This is done on purpose to stop sql injection attacks. You will need to break up the queries in some way and feed them into mysql_execute one at a time.