I have the following:
$name = \'registrations.csv\'; header(\'Content-Type: text/csv\'); header(\'Content-Disposition: attachment; filename=\'. $name); heade
Change mysql_fetch_array() to mysql_fetch_assoc(). mysql_fetch_array() fetches both a numeric and associative array of the database results.
mysql_fetch_array()
mysql_fetch_assoc()
while( $result = mysql_fetch_assoc$results) ) { fputcsv($outstream, $result); }