php - Export mysql database using OUTFILE command into .sql format -


here want export database .sql format.i tried select * outfile --- --- command returns records not whole structure of table. code is

<?php   //include("db.php");    $dbhost = 'localhost';  $dbuser = 'root';  $dbpass = '';  $conn = mysql_connect($dbhost, $dbuser, $dbpass);  if(! $conn )  {    die('could not connect: ' . mysql_error());  }  mysql_select_db('ganga_hms');  $table_name = "accountant";  $backup_file  = "c:/xampp/htdocs/finalhms/accountant.sql";  $sql = "select * outfile '$backup_file' $table_name";    $retval = mysql_query( $sql, $conn );  if(! $retval )  {    die('could not take data backup: ' . mysql_error());  }  echo "backedup  data successfully\n";  mysql_close($conn);  ?>

however want export table structure. , suggest me how export whole database using php.

to dump database need "mysqldump" tool, if not have tool on server , can not install it, you'll need complex script runs on of tables , gathers table structure , data this: http://davidwalsh.name/backup-mysql-database-php


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -