Answer the question
In order to leave comments, you need to log in
How to split a record in cvs from mySQL into columns in Excel'e?
Good day to all.
I export a table from the database to a CSV file, but all the data is written in one column, how can I split them?
The code itself:
$result = $db->AllStudents($db);
$file_name = 'export.csv';
$out = fopen($file_name, 'w');
fputs($out, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF) ));
foreach ($result as $student){
fputcsv($out,$student);
}
fclose($out);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question