Hi all,
I am back again with another question.
I have an sql file that has INSERT INTO statements in the file. I would like to plug that file into an input box, press a "Restore" button and have that file restore the database. I can get it to work.
I thought I could just use php's exec() function but that doesn't work either. What I need to do is the same as:
mysql -u root -p pass < mySQLFile.sql
Here is what I have managed to scrounge up so far for php
[php]
$back = fopen($_POST['file'],"r");
$contents = fread($back, filesize($_POST['file']));
$res = mysql_query(utf8_encode($contents));
Im lost from here....
fclose($back);[/php]
I have looked and searched for a script or a class to show me how to do this but have come up empty handed.
Could someone please give me a hand?
Thanks,
Frank