-1
$query = "select * from korzina";
$result = mysqli_query($link, $query);
echo "<table border=1>";
echo "<tr><th>№</th><th>Аты</th><th>Бағасы</th><th>Саны</th></tr>";
while($r = mysqli_fetch_assoc($result)){
echo "<tr><td>$r[id] </td><td >$r[Name] </td><td>$r[Price] </td><td>$r[Num]</td></tr>";
echo "<td><a href='delete.php?id=".$r['id']."'>delete</a></td>";
}

when i display database info on an html page like that, russian letters turn into question marks.

and when i add info like this:

$sql= 'INSERT INTO korzina (Name, Price, Num)
VALUES ("'.$nam.'","'.$prcc.'", "0")';
mysqli_query($conn, $sql);

in the database it is displayed with symbols like this ййй, ццц, ннн, but on the html page it's completely fine.

everywhere i could think of is set to utf8

1 Answers1

1

There are some cases, which can influence the situation with charset:

  1. MySQL connection charset (for example, you can use mysqli_set_charset function in order to set right charset)
  2. Database, table and column charset must be correct (do ALTER TABLE if needed)
  3. Page charset (it may affect on charset of HTML form, that browser sent to server) - use PHP function header("Content-Type: text/html; charset=utf-8") before ANY output
Lyudmila
  • 71
  • 2