Hey Dave long time since we last spoke. I wondered if you could use something like what I have done (obviously my code was for a different purpose but its taking a single field from a recordset as an array and outputting it. I wondered if taking a look at my code and seeing how it works can help you solve your question?
<?php require_once('../Connections/ecartdb.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=emails.csv');
$output = fopen('php://output', 'w');
$rows = new WA_MySQLi_RS("rows",$ecartdb,0);
$rows->setQuery("SELECT NewsLetterEmail FROM newsletter");
$rows->execute();
while(!$rows->atEnd()) {
$row = array($rows->getColumnVal("NewsLetterEmail"));
fputcsv($output, $row);
$rows->moveNext();
}
$rows->moveFirst(); //return RS to first record
?>
Regards
Chris