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

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";
include 'closedb.php';

All those are is connection and configs like this:

$host = "localhost";
$username = "dbusername";
$password = "dbpassword";
$dbname = "database name";


$link = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db ($dbname, $link) or die(mysql_error());



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?