my csv file only gets one row
<p>I'm outputting a temporary table to a csv file, but it only gets one row ?</p>

<p>here is the code</p>

<pre><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);
</code></pre>

<p>I haven't got a clue now. I was trying to use fputcsv but I can't get that working either</p>
