I want to copy the database, create a new temporary one to work on only in php and once done want to update the original one. My problem is how to dump the original data into temporary database. I did that in qt creator, by create the new one and copy all the tables with data, is there any efficient way in php other than that.
Thanks in advance
Here is the code but with this only half of the database is exporting to a file
$qry_drop = "DROP DATABASE `temp-$pro_name`";
$re_drop = mysqli_query($connection, $qry_drop) or die(mysqli_error($connection));
$qry_temp_db = "CREATE DATABASE `temp-$pro_name`";
$result_temp = mysqli_query($connection, $qry_temp_db) or die(mysqli_error($connection));
exec("mysqldump -u *** -p* -h * test_empty > my_database_dump.sql", $output1, $return1);
echo $return1 . "<br/>";
if(!$return1){
echo "Export succesfully";
}
else{
echo "Unable to Export <br/>";
}
//exec("mysql -u sumit -p temp-test_empty < /172.16.0.150/var/www/html/my_database_dump.sql", $output, $return);
exec("mysql -u **** -p*** -h *** temp-test_empty < my_database_dump.sql", $output, $return);
echo $return . "<br/>";
if(!$return){
echo "Import succesfully";
}
else{
echo "Unable to import <br/>";
}