Neptunus Maris Posted May 12, 2008 Share Posted May 12, 2008 Is this correct? <?php mysql_query("SOURCE file.sql"); ?> Is that correct to run a *.sql file on your server through PHP? Thanks, Neptune Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 12, 2008 Share Posted May 12, 2008 Why don't you try it yourself? =P Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted May 12, 2008 Author Share Posted May 12, 2008 Why don't you try it yourself? =P Damn...lol Quote Link to comment Share on other sites More sharing options...
DarkWater Posted May 12, 2008 Share Posted May 12, 2008 It IS the correct way to do it, but you really could have tried it yourself. =P Quote Link to comment Share on other sites More sharing options...
Barand Posted May 12, 2008 Share Posted May 12, 2008 Any idea what versions of PHP/MySQL you need for that? I can't get it to work. <?php mysql_query ('SOURCE mytest.sql') or die(mysql_error()); ?> --> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SOURCE mytest.sql' at line 1 Quote Link to comment Share on other sites More sharing options...
cheechm Posted May 12, 2008 Share Posted May 12, 2008 <?php mysql_query ('LOAD DATA INFILE mytest.sql') or die(mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted May 12, 2008 Share Posted May 12, 2008 This worked <?php exec ('mysql < mytest.sql') ; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.