Good time! The problem is this: the sample is not correctly sorted here:

$tmpl = mysql_query("SELECT * FROM leners WHERE idg='$ida' ORDER BY name ASC"); 

the name of the Cyrillic is written in the name field, the encoding of the field is also utf8 general ci, the encoding of the document is also utf8 - BUT in PMA, when viewing the table, all names look nice so

  Ðбайұлы Ð'ауыржан 

This is due to the fact that when connecting to the database, the encoding was not set at one time, this is why the data is recorded normally, when displaying on the site, they also have a normal appearance, but the database is stored in the form of cracks; to. they are sorted in the form of cracks. Is there any solution not to change the encodings (I'm afraid to lose the data already recorded in the database), but so that the sorting is normal, it can indicate, like the encoding, already with the sql query itself, or when sorting by name?

  • And in the PMA settings, what encoding is specified? - Andrew Hobbit
  • in order not to be afraid of losing data, backup your database. To specify the encoding in the query, use the order by name asc collate utf8_general_ci , but this is a private solution, and it is better to solve the problem globally. - teran

1 answer 1

In the response header you need to put utf-8.

 header('Content-Type: text/html; charset=utf-8'); 
  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky
  • @Pavel Kuznetsov, excuse me, this is obtained in the request header as it is necessary to prescribe ?? - dantelol