What I have are a series of forms which inste开发者_开发百科ad of being emailed to the webmaster, are stored in a database. These entries are being output in an admin area, but this can get crowded so I would like to provide a download link for the user to download a readable file. CSV could be the most basic, but if it was possible, a spreadsheet would be even better. At the very least an SQL dump file.
I'm working in mySql and PHP.
Thanks, Henry
This is really not very difficult:
SELECT t1.a, t2.b
FROM table1 t1
INNER JOIN table2 t2 ON (t1.id = t2.table1_id)
WHERE table2.somefield = 'something' INTO OUTFILE 'outfile.csv';
Now offer a download link to outfile.csv.
Links:
http://dev.mysql.com/doc/refman/5.0/en/select.html
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
You could incorporate phpMyAdmin into your app, as Einacio mentioned in a comment for your question, or you could use the mysqldump program to create a .csv file in a location from which users can download it.
精彩评论