Page 1 of 1

Dumping Table Data To TXT File

Posted: Thu Jul 22, 2004 9:14 pm
by furiousweebee
Here I am again with another novice question. If I have a page of data that is presented using PHP to get the information from MySQL, is there some way to give the user the option to save the results of the query into a TXT file instead of showing it formatted on screen in HTML?

So for example, they use my search facility to find a series of records. Then they want to save that information as a file (without copying and pasting of course). Is there a way to have a link which, when clicked, will use the results of the previous query to save a TXT file?

Posted: Thu Jul 22, 2004 9:33 pm
by kettle_drum
Just reload the same page again and have an if statment that checks to see if the button was pressed, and if it was print the data to a txt file instead. Search the forums to see how you can get a file to start to download.

Posted: Thu Jul 22, 2004 9:35 pm
by furiousweebee
Alrighty, thanks man. I'll look into it. :)

Posted: Fri Jul 23, 2004 5:44 am
by furiousweebee
This solution is slightly off the mark from my original question, but it does exactly what I want it to do. It can save data as Excel or Word files.

http://www.hotscripts.com/Detailed/13890.html