What i do with this code is: I ask the user to select a backup to restore(Check) When the user hit the "Submit" button moves the file to a local carpet of the server(Check) I call the System function to call mysql.exe to restore the sql file that is in the local server(Problem here)
<?php
if($_FILES['enviar']){
$file_name="Respaldo.sql";
move_uploaded_file($_FILE['enviar']['tmp_name'],"Backups/$file_name");
$batche=system("C:/WAMP/BIN/MYSQL/MYSQL5.5.24/bin/mysql.exe -u root test < C:/WAMP/WWW/Backups/respaldo.sql");
echo $batche;
}
?>
If i copy exactly this "C:/WAMP/BIN/MYSQL/MYSQL5.5.24/bin/mysql.exe -u root test < C:/WAMP/WWW/Backups/respaldo.sql" into a windows shell it restores the backup without any problem, Any help?.. Thanks
----EDIT---
The problem is that when I call the system function it doesn't do the restoring task, the DB remains Empty.
$batche=system("C:/WAMP/BIN/MYSQL/MYSQL5.5.24/bin/mysql.exe -u root test < C:/WAMP/WWW/Backups/respaldo.sql");
Instead of above code you will replace like below as follows:
$batche=**shell_exec** ("C:/WAMP/BIN/MYSQL/MYSQL5.5.24/bin/mysql.exe -u root test < C:/WAMP/WWW/Backups/respaldo.sql");