0

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.

1
  • Can't you simply write your CSV content in a new file ? Commented Jun 27, 2014 at 11:21

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

0
  1. Create file using CSV separator i.e ;
  2. Create downloading page, you have to set some headers
  3. Download All.

Comments

0

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.