Jump to content

Recommended Posts

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

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']
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.