What is the php script for converting a mysql table to text file? I have converted it to CSV format which opens up as a excel file. I also want the table data in a text file. How do I do it?
For converting it to csv format, I used the header data as:
$filename = "export_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header("Content-disposition: filename=".$filename.".csv");
I tried using header(“Content-type: text/plain”); and used the .txt extension. It didn’t work.. Someone guide me please.
I found a way to save my table in text format, saved as a ms word application with .doc extension. And the headers are given below
But now I’m trying to display it in a table format in the text file.. Because it looks like junk data without any alignment. Adding tab space doesn’t help.. Any suggestions?