I've had a look around but I seem to only get my .php file downloaded instead of the specific data I need. (So my .csv file gets the <doctype> down to the </html>)
What I am trying to do, is call some data from a MySQL database with php, this works fine though it excludes entry number 1 thats also fine as this entry wont have correct data anyway.
That is the code I am using, but it doesn't seem to work - and the dummy code I worked from also gave the same kind of file rather than any information I actually had inputed to test - not even 'echo "test";' worked in the file.
Perhaps I didn't find very good code to work from in the first place, but if anyone can help me I'd be very grateful.
As a side note this is being done in the back end of wordpress relating to a plugin I have developed, so I would rather not find another plugin just to download this file
Ara
L.U.N.E for anyone and everyone who has an interest in literature
// set your headers, then... if(($fh = fopen('php://output', 'w')) != false) { while ($checked = mysql_fetch_array($sql_check)){ fputcsv($fh, $checked); } while ($checked2 = mysql_fetch_array($sql_check2)){ fputcsv($fh, $checked2); } fclose($fh); }
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks