Try this for outputting to a CSV:
<?php
$Recordset1 = new WA_MySQLi_RS("Recordset1",$BHSmySQL_i,0);
$Recordset1->setQuery("SELECT * FROM `extract`");
$Recordset1->execute();
?>
<?php
// set headers to force download on csv format
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=extract.csv');
$out = fopen('php://output', 'w');
// we initialize the output with the headers
fputcsv($out, array('playlist_name','pid','sid','contestant_name','performance_song_title','category','username','score','comments'));
// select all members
while (!$Recordset1->atEnd()) {
// add new row
fputcsv($out, array($Recordset1->getColumnVal('playlist_name'),$Recordset1->getColumnVal('pid'),$Recordset1->getColumnVal('sid'),$Recordset1->getColumnVal('contestant_name'),$Recordset1->getColumnVal('performance_song_title'),$Recordset1->getColumnVal('category'),$Recordset1->getColumnVal('username'),$Recordset1->getColumnVal('score'),$Recordset1->getColumnVal('comments')));
$Recordset1->moveNext();
}
// export the output
fclose($out);
?>