CSV Files

From: Date: Wed, 22 Oct 2008 23:59:44 +0000
Subject: CSV Files
Groups: php.general 
Request: Send a blank email to php-general+get-282316@lists.php.net to get a copy of this message
Hi All, I need to take a record in MySQL and have my user get it as a CSV File. I am OK with most everything, except when I create the CSV file, I write out the column headers then I need to write out the data. After I right out the column headers do I have to put a '/n' to have it start a new line in the CSV file? I think I do. Here is what I have (a snippet): header("Content-type: application/csv"); header($filenameString); header("Pragma: no-cache"); header("Expires: 0"); echo $map_BORROWER_FIRST_NAME.", "; echo $map_BORROWER_LAST_NAME.", "; echo $map_BORROWER_SSN.", "; echo $map_BORROWER_HOME_PHONE.", "; echo $map_BORROWER_DOB; echo "/n"; echo $row[BORROWER_FIRST_NAME].","; echo $row[BORROWER_LAST_NAME].","; echo $row[BORROWER_SSN].","; echo $row[BORROWER_HOME_PHONE_FIRST].$row[BORROWER_HOME_PHONE_MIDDLE].$row[BORROWER_HOME_PHONE_LAST].","; echo $row[BORROWER_DOB_MONTH].$row[BORROWER_DOB_DAY].$row[BORROWER_DOB_YEAR]; When I run this, I see my column names, but not the data. The query seems to execute just fine.... Any advice? Thanks, -Jason

« previous php.general (#282316) next »