I'm using this fputcsv code:
$result = mysql_query('SELECT * FROM `mash`');
if (!$result) die('Couldn\'t fetch records');
$fp = fopen('testCSV.csv', 'w');
if ($fp && $result) {
while ($row = mysql_fetch_array($result)) {
fputcsv($fp, array_values($row));
}
die;
}
fclose($fp);
It outputs the CSV great but there are two columns for each mysql column (so everything is doubled)
could anyone see why that would be?
die, which ends the program, so there's no point in checking$resultlater on when it can't possibly be false. You alsodieafter your loop ending the program before you close the file pointer. Why?