I’m outputting a temporary table to a csv file, but it only gets one row ?
here is the code
$fileName = fopen('cmv_sailings.csv', 'w');
while ($i = mysql_fetch_assoc($export)) {
$ship = $i['code'];
$title = $i['title'];
$sailDate = $i['sailDate'];
$fromPort = $i['fromport'];
$nights = $i['nights'];
$grade = $i['type'];
$fare = $i['fare'];
$offer = $i['offerFare'];
$deposit = $i['deposit'];
$content = $ship.','.$title.','.$sailDate.','.$fromPort.','.$nights.','.$grade.','.$fare.','.$offer.','.$deposit.'\n';
fwrite($fileName, $content);
}
fclose($filename);
I haven’t got a clue now. I was trying to use fputcsv but I can’t get that working either
use like this, The main problem I can seen in your code is using single quote for \n that’s why new line character is not getting added in your csv file and you are getting your result in one single line