I figure out how to write all the entries from my database onto a text file.
header("Content-Disposition: Attachment; filename=test.txt");
How do I modify the text file??
Each entries (or row) have 5 elements in it and there are multiple entries in my database.
How do I write each elements follow by a comma onto a text file? Each row in the database would have a new line in my text file as well.
Start with fetching the results from the database first (using a while, or foreach, or for loop), once you have that, you will use fopen (before your loop), and fwrite (inside your loop), then fclose (after your loop).
If you need a more thorough example, let me know.
I'm thinking putting all my sql onto an array then read each element with a for/while loop
But how do I break up each element in the entries, so I can read it??
This topic is now closed. New replies are no longer allowed.