I wanna export a database into an .sql file or gz file I wanna do it with php something like that which happen when you are in phpmyadmin and do export, you will prompt for download ... Thanks ...
try this not all hosts allow it but if system() operation is allowed this is an easy way. config, opendb need to contain the variables to connect to the db with the variables used below <?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'; ?>