Page 1 of 1

running multiple MySQL queries in batch from PHP

Posted: Wed Mar 31, 2004 10:55 am
by davidklonski
Hello

I have an SQL file which contains numerous queries which I use in batch mode to initialize the database.

I would like to run this file from PHP.
The problem is that the file contains numerous queries while mysql_query accepts a single query.

Is there a way to run a batch of queries from PHP?
I am talking about commands like:
drop table, create table, insert...

thanks in advance

Posted: Wed Mar 31, 2004 11:07 am
by kettle_drum
What i do is place each query into an element of an array, and then you can simply include the sql file and do a foreach on the array and run the sql.