how to creat CSV file with data from MySql By using of PHP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
falcons
Forum Newbie
Posts: 16
Joined: Mon Nov 10, 2008 8:00 am

how to creat CSV file with data from MySql By using of PHP?

Post by falcons »

Hello every one ...
i am new in PHP and also in this forum .. i have a problem so please help me ..
i want to create a csv file with the data getting from database by using of php..

i wanat to click on "export" link and data will be save in CSV file and download that file into local system ...
so please help me .. thanks
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: how to creat CSV file with data from MySql By using of PHP?

Post by VladSun »

http://dev.mysql.com/doc/refman/5.0/en/select.html
and search for "OUTFILE" in the text ;)
There are 10 types of people in this world, those who understand binary and those who don't
falcons
Forum Newbie
Posts: 16
Joined: Mon Nov 10, 2008 8:00 am

Re: how to creat CSV file with data from MySql By using of PHP?

Post by falcons »

VladSun wrote:http://dev.mysql.com/doc/refman/5.0/en/select.html
and search for "OUTFILE" in the text ;)
i wanat to write a code in php
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: how to creat CSV file with data from MySql By using of PHP?

Post by aceconcepts »

falcons
Forum Newbie
Posts: 16
Joined: Mon Nov 10, 2008 8:00 am

Re: how to creat CSV file with data from MySql By using of PHP?

Post by falcons »

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 84

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 85

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 86

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 87

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 89

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 90

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test-club-asia\index.php:20) in c:\wamp\www\test-club-asia\index.php on line 91

the line 84 t0 91 are
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=your_file_name.xls");
header("Content-Transfer-Encoding: binary ");


so how to remove this error ?
why getting this error?
Post Reply