rubing Posted September 7, 2008 Share Posted September 7, 2008 good evening folks. I have a website, which logs a lot of client info to a mysql database. I want to offer these logs to the client as a file download (csv, sql, whatever...) so, I know its easy to create a dump file of a database with the mysql dump command. But I am confused as to how to let a customer download a dump of their customer data. I guess basically I am asking how do I get php to present a file for download to the client??? Link to comment https://forums.phpfreaks.com/topic/123077-offer-dump-file-of-db-with-php/ Share on other sites More sharing options...
ratcateme Posted September 7, 2008 Share Posted September 7, 2008 try this // We'll be outputting a PDF header('Content-type: text/plain'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename="database.sql"'); echo `mysqldump -ppassword -uusername database`; Scott. Link to comment https://forums.phpfreaks.com/topic/123077-offer-dump-file-of-db-with-php/#findComment-635597 Share on other sites More sharing options...
rubing Posted September 7, 2008 Author Share Posted September 7, 2008 yup. works great!! apreciate it scott!!! thanks. Link to comment https://forums.phpfreaks.com/topic/123077-offer-dump-file-of-db-with-php/#findComment-635609 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.