I am trying to add a single column at the beginning of a csv file using the code below:
while ($row = mysqli_fetch_array($rows, MYSQL_ASSOC)) {
$list = "'2795', $row";
fputcsv($output, $list);
}
What am I missing? I know it's something simple. Thank you in advance.
You can't just join those values together:
Since
$row
returns a row result array, treat it as such, push that value inside:Sidenote: This is a truncated code, so just make sure you have that file handle above this code that you presented.