http://www.ineedtutorials.com/code/php/export-mysql-data-to-csv-php-tutorial
Export a table to CSV with php/mysql
include("db_conn.php"); $file = 'Export'; $result = mysql_query("SHOW COLUMNS FROM [[TABLE]]"); $i = 0; if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $csv_output .= $row['Field']."; "; $i++; } } $csv_output .= "\n"; $values = mysql_query("SELECT * FROM [[TABLE]]"); while ($rowr = mysql_fetch_row($values)) { for ($j=0;$j<$i;$j++) { $csv_output .= $rowr[$j].";"; } $csv_output .= "\n"; }... Continue Reading →