Wednesday, January 12, 2011

PHP export mysql table to text file


Here is simple script which will help you a bit, to export all fields of your database table to text file. It will not be same as export of MyAdmin, but its better than nothing... at least you will have data.
$sql_export = "SELECT * INTO OUTFILE 'tables.txt' FROM `table_name` ";
//var_dump($sql_export);
if($result = mysql_query($sql_export))
echo "Recorded";
else echo "Not recorded";

No comments:

Post a Comment