Reputation: 7
how to save a csv file in server itself containing the data fetching form mysql dtatbase? i want to download a database in csv format.I am able to download the contants directly, but I need to save all the fetched data into server itself and provide the user a link to download the data into xls or csv format. I am new to this field and I really don't have any idea how to save the CSV file in server itself.
Upvotes: 0
Views: 585
Reputation: 3557
You can write fetched data in a file and then can save this file your server.
There are many php libraries for this job. I Personally use PHPExcel. You can download it from: https://phpexcel.codeplex.com/
Upvotes: 0
Reputation: 122
You can first query the database with required conditions and write the contents into a CSV file on your application server & later on provide a link to this file in your application. You may check the following link on how to obtain data, convert to CSV & write to file :
PHP code to convert a MySQL query to CSV
Upvotes: 1
Reputation: 421
;
Upvotes: 0