Loading .sql files from within PHP

Posted by Josh Smeaton on Stack Overflow See other posts from Stack Overflow or by Josh Smeaton
Published on 2008-09-29T07:38:09Z Indexed on 2010/06/01 3:23 UTC
Read the original article Hit count: 258

Filed under:
|
|
|
|

I'm creating an installation script for an application that I'm developing and need to create databases dynamically from within PHP. I've got it to create the database but now I need to load in several .sql files. I had planned to open the file and mysql_query it a line at a time - until I looked at the schema files and realised they aren't just one query per line.

So, please.. how do I load an sql file from within PHP? (as phpMyAdmin does with it's import command).

© Stack Overflow or respective owner

Related posts about php

Related posts about sql