Forum Moderators: coopster

Message Too Old, No Replies

A PHP script that outputs mySQL query

         

irock

5:55 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I need to output my mySQL table selectively to bunch of INSERT queries. So I turn to phpmyadmin, but it will only allow me to dump the table in only number of records. I, however, would want to output INSERT queries by selecting the ID in the mySQL table.

Do you know where i can find that script?

thanks

daisho

6:47 pm on Sep 26, 2003 (gmt 0)

10+ Year Member



no script. use mysqldump. You can provide a "where clause" and it will only dump what matches. And it nativly dumps in SQL.

daisho.

irock

7:20 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it only executable in SSH?

Also could you provide an example how to use WHERE clause along with mysqldump?

thanks much!

coopster

7:24 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



/yourpath/mysqldump "--where=(ID='myID')" database table > mydump.sql

jatar_k

7:25 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



mysqldump, Dumping Table Structure and Data [mysql.com]

look for this

-w, --where='where-condition'
Dump only selected records. Note that quotes are mandatory:

daisho

7:32 pm on Sep 26, 2003 (gmt 0)

10+ Year Member



Yes only via SSH, local console or shudder telnet...

Really mysqldump is a console app. The method of getting to the console doesn't matter.

daisho