you might use a variation of the following approach which outputs the data from any MySQL table in csv format using PHP:
do_query("SELECT * FROM table_name; ");
if (mysql_num_rows($result) == 0) {
echo("No rows found, nothing to print");
exit;
}
$field_count = mysql_num_fields($result);
for($i = 0; $i < $field_count; $i++) {
echo mysql_field_name($result,$i);
echo(",");
}
echo("\n");
while($row = mysql_fetch_array($result)) {
for($i = 0; $i < $field_count; $i++) {
echo($row[$i].",");
}
echo("\n");
}
or, you might use the "mysqldump" command-line utility with options such as:
--fields-terminated-by=...
--fields-enclosed-by=...
--fields-optionally-enclosed-by=...
--fields-escaped-by=...
--lines-terminated-by=...