F
F
First Name2017-05-15 15:33:31
PHP
First Name, 2017-05-15 15:33:31

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);

hKkPNP3yWls.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2017-05-15
@maxxtweek

Nadi use semicolons instead of commas.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question