systech44 Posted March 30, 2010 Share Posted March 30, 2010 I wish to restore the data of tables of my database into Excel(.xls) or any other format. Below is my code. <?php mysql_connect("localhost","root",""); mysql_select_db("test"); $dbname = "test"; $dbhost = "localhost"; $dbuser = "root"; $dbpass = ""; $backupFile = "restore"; $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); ?> There is no error. But I cannot see the output. Please tell me what is wrong with my code. Please rectify. My environment is as below: Windows XP WampServer Thanks a lot in advance. Link to comment https://forums.phpfreaks.com/topic/196953-mysql-database-backup/ Share on other sites More sharing options...
oni-kun Posted March 30, 2010 Share Posted March 30, 2010 Note: When safe mode is enabled' date=' you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have ".." components in the path to the executable.[/quote'] With safe mode enabled' date=' the command string is escaped with escapeshellcmd(). Thus, echo y | echo x becomes echo y \| echo x.[/quote'] Link to comment https://forums.phpfreaks.com/topic/196953-mysql-database-backup/#findComment-1033973 Share on other sites More sharing options...
systech44 Posted March 30, 2010 Author Share Posted March 30, 2010 Thanks for the reply. But I will be obliged if you please elaborate this matter. Also please try to modify the code, if possible. Thanks you once again. Link to comment https://forums.phpfreaks.com/topic/196953-mysql-database-backup/#findComment-1034012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.