So I found a script to get a csv file from the database table.
<?php
header('Content-Type: text/csv; charset=utf-8 ');
header('Content-Disposition: attachment; filename=data.csv');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
fputcsv($output, array('id','Name', 'Email', 'age','tekens'));
// fetch the data
mysql_connect('localhost', 'name', 'pass');
mysql_select_db('name');
$rows = mysql_query('SELECT * FROM info');
// loop over the rows, outputting them
while ($row = mysql_fetch_assoc($rows))
fputcsv($output, $row);
?>
The code works but I have trouble with the characters. My database table looks like this : Database table
This is how I want it in my csv file. However my csv file looks like this : Csv file
In the csv file Хой shows like ???. Is there a way to fix this?
I am sorry if it's a duplicate. I tried so many different things.