If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > how to save to cvs from mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-04, 00:37
noamkrief noamkrief is offline
Registered User
 
Join Date: Dec 2003
Posts: 61
how to save to cvs from mysql

I use phpmyadmin and noticed that there's an option to save an entire database to a cvs file (excel)

That's really cool.
Is it hard to hadd a button to my site that lets a user do that himself?
But he needs to save only his flights like with a criteria of PERSON_ID = @#$@#%#$%

Can someone tell me how to do it or direct me to a link? i use php for the site.
Is there any sort of security risk of using this feature?

thanks
Noam
Reply With Quote
  #2 (permalink)  
Old 03-16-04, 04:38
omiossec omiossec is offline
Registered User
 
Join Date: Jan 2003
Location: Paris, France
Posts: 320
Re: how to save to cvs from mysql

Quote:
Originally posted by noamkrief
I use phpmyadmin and noticed that there's an option to save an entire database to a cvs file (excel)

That's really cool.
Is it hard to hadd a button to my site that lets a user do that himself?
But he needs to save only his flights like with a criteria of PERSON_ID = @#$@#%#$%

Can someone tell me how to do it or direct me to a link? i use php for the site.
Is there any sort of security risk of using this feature?

thanks
Noam
You can use the SELECT ... INTO OUTFILE .... Syntaxe to perform a CSV export from your request
__________________
Olivier Miossec
--
http://www.lasso-developpeur.net/
--
Reply With Quote
  #3 (permalink)  
Old 03-16-04, 12:39
noamkrief noamkrief is offline
Registered User
 
Join Date: Dec 2003
Posts: 61
how do i do that exactly? i don't have much experience with exporting. so far i've been using phpmyadmin. i've been searching on google alot but can't find anything
thanks
Noam
Reply With Quote
  #4 (permalink)  
Old 03-17-04, 02:01
pekron pekron is offline
Registered User
 
Join Date: Mar 2004
Posts: 8
Quote:
Originally posted by noamkrief
how do i do that exactly?
Noam
You could write a outfile-query like this:

SELECT DISTINCT * INTO OUTFILE "/[abs_path]/result.txt"
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY "\n"
FROM myTable WHERE PERSON_ID = $person_id

Your destination-folder must have write-permission for all

/pekron
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On