html - UTF8 combination PHP/MySql -
this question has answer here:
- utf-8 way through 14 answers
my sql database have utf8_unicode_ci collation , html have utf8 (meta charset="utf-8").
when write in php:
$query = "select * `subjects` `year` = '$year'"; $result = $mysqli->query($query); while($row = mysqli_fetch_array($result)){ echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>"; }
instead čćšđ getting crazy values like: ?�...
add
mysql_query("set names 'utf8'"); mysql_query("set character set 'utf8_general_ci'");
before
$query = "select * `subjects` `year` = '$year'";
Comments
Post a Comment