I'm trying to write a script that creates tables and inserts rows on a mysql database.

Can anyone tell me how to do this? There are a lot of ways one could execute a large number of CREATE TABLE queries but that doesn't seem to work for me for some reason (I've tried several ways including simple mysql_query()'s but none of them add everything correctly).

Do I have to make the script wait some milliseconds, or is there an easy way to make the script execute a query in a .sql text file? If anyone has something helpful for me, I would appreciate it. A best case scenario here would be for me to be able to just give people an sql file which the installation script would ask for with a file input.