PDA

View Full Version : exporting selective data from mysql to local file


martino2000
2-19-04, 05:09 PM
I'm new to sql and php but have an up and running database with pages dealing with the data. What I am finding hard to figure out is to export the data selectively to users local machine.

I have an extensive roster with many fields from which we want to create mailing lable lists, email lists etc. This need different fields, selected and sorted differently. I was thinking in terms of a cvs file. Unfortunately select load data infile local does not seem to have a reverse local option so the file can be created on their machine. msqldump seems totally inappropiate for what I need.

Pig
2-19-04, 05:32 PM
http://phpmyadmin.powweb.com

Go there and log in. There is an export tab with CSV options.

martino2000
2-19-04, 06:50 PM
Can this be run on the client machine via a web page such that the file ends up on the local machine? Can I use it with selecting only specific fields and then sorting them as I do in a select? I used it to dump the whole file but I was logged on to the server not running it from a web page and I could not figure out how to specify only certain fields and have them sorted as I wished.

mitchind
2-19-04, 09:16 PM
You're going to need to write some code sooner or later if you want to do this.

What you need is a front-end page to your database to allow users to select the fields, determine the sorting order and assign their filters. The results will go to to a file from a dynamic SELECT INTO OUTFILE 'filename' (SQL statement).

Then you can offer the user the link to download the file.

With your lack of experience you'd probably be better looking for a script that does something close to what you want before you try it yourself. There might be something here at http://php.resourceindex.com under the Database Manipulation section