I am trying to build an array from db but need to insert a calculated value: $group
, into each row of output. When I plug it into fputcsv
, the resulting file says:
Warning: fputcsv() expects parameter 2 to be array.
null given in /update-csv.php on line 67
My related code reads as follows:
while ($row = mysqli_fetch_assoc($result)) {
$updateArray[][] = array(
array( $row['firstLast'], $row['firstName'], ($row['lastName'], $group,$row['email']));
fputcsv($output, $updateArray);
NOTE: This is line 67
I believe my error is in building the array but can't figure out where it's wrong.
Overkill. Unless you're trying to save each array for later in the script, all you need is this:
$updateArray = array( $row['firstLast'], $row['firstName'], $row['lastName'], $group, $row['email'] );