Yes you can run querys from the mysql prompt and redirct them to a file.
Here's how.

Make a file and call it query. Inside the file put something like this:

use db_mydatabase
select * from tbl_mytable where something=somethingelse;

Then from the prompt (not in the mysql prompt) use this command:

mysql -h somehostname -u username -p < query > results

enter the password for the user then edit the results file which it created
and there you go.



Matthew Scarrow
ComIT Solutions Inc.
www.comit.ca
Phone: 519-442-0100
Fax:   519-442-0429


-----Original Message-----
From: Brandon McCombs [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 14, 2002 5:53 PM
To: [EMAIL PROTECTED]
Subject: redirect output to a file?


Hi,

WIth the way eSKUeL (a PHP app I found on freshmeat) displays query
results in a table, and the way that copying and pasting that data into
a xls or doc file appears I'm hoping to be able to run queries manually
on the mysql prompt and have the output redirected to a file so that I'm
able to more easily print the output because I don't want all the
information that eSKUeL displays on output either (it doesn't make a new
page for results so you can see all the available commands as well and I
don't want those visible when results are printed). Is there a way to
redirect query output to a file? I didn't see anything in the manual
that specified how to do this.

By the way, when I copy and paste the data from the html table that
eSKUeL displays the results in it appears in excel or word such that
each piece of data that was within a cell is put onto a different line
so everything is vertical when pasted, instead of having a full line for
each record. Obviously that isn't useable.

THanks
Brandon

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to