I have a mysql query that runs in a php file that outputs a page of data. I need to somehow output that data to a file, to allow me to perform client side functions on that data as needed before exporting it for download.
I need the temporary file named as a timestamp. Im wondering if i should use the fopen to create the file with the name being something like echo date(), then fwrite = $mysql, then fclose?
Is this the correct way to do this?
You could definitely do it that way. If it works for your purposes, then I would consider it correct. Sounds like you’ve got a good handle on it.
If you want the filename with actual date numbering instead of a UNIX timestamp, use this instead:
You’ll have to get your data into an exportable format of course… the code above assumes that
$mysqlcontains your data and not just a query resource.