Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    61

    Unanswered: 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

  2. #2
    Join Date
    Jan 2003
    Location
    Paris, France
    Posts
    320

    Re: how to save to cvs from mysql

    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/
    --

  3. #3
    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

  4. #4
    Join Date
    Mar 2004
    Posts
    8
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •