Hello I need to get data from a database and write the db dump to a server as txt file
any ideas?
Hello I need to get data from a database and write the db dump to a server as txt file
any ideas?
looks like there is an error in the restore section of the example, I'm sure that
$query = "LOAD DATA INFILE 'backupFile' INTO TABLE $tableName";
is suppose to be
$query = "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName";
what about the icluded files
<?php
include 'config.php';
include 'opendb.php';
$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
system($command);
include 'closedb.php';
?>
All those are is connection and configs like this:
config.php
$host = "localhost";
$username = "dbusername";
$password = "dbpassword";
$dbname = "database name";
opendb.php
$link = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db ($dbname, $link) or die(mysql_error());
closedb.php
mysql_close($link);
if you are going to use the system($command);
option, I don't think you actually need to create a database connection, I don't know, maybe you do.
I think this is to get all the DB what about to get certain information from one tabel?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.