Export query results to file
Moderator: General Moderators
Export query results to file
Hi. I need to send the results of a query to someone who does not have access to our database. This result set is 2500+ items long, which exceeds the buffer of my client, so copy & paste won't work. I know i can dump the table itself to a file, but I really need the sorted results of the rather elaborate query. I'm stumped.
Code: Select all
select into outfile 'filename' їexport options] from table where foo = barIf you want to do some formatting of that data in a special way, you could just write out to a file handle using something like fopen() and fwrite(). Another option would be to just echo the formatted data and pipe it into a document. At the command line it would look something like...
This is command line stuff FYI. The above line will work in both Windows and Linux.
Cheers,
BDKR
Code: Select all
your_script.php > output.txtCheers,
BDKR