Re: novice: how to run .sql script from php?
| From: | John Nichel | Date: | Fri, 27 May 2005 13:48:46 +0000 |
| Subject: | Re: novice: how to run .sql script from php? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215857@lists.php.net to get a copy of this message | ||
tony yau wrote:
Hi All,Either do it with a query.... mysql_query ( "LOAD DATA INFILE 'file.sql'" ); Or use a system command in php... $command = "mysql db_name < file.sql"; exec ( $command ); -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.comI got this .sql script that setup the whole db schema, I can runmysql.exe to run on my pc but when it goes to a hosting company's server I don't have that command!So I tried to include("setup.sql") into a string and send that as onelong sql query. BUT I need to get rid of all the comment lines first in the script!!can someone give me a better idea of doing this. (there must be an equivalent php function likemysql_run_script("setup.sql"))