Ile Popivanov Ile Popivanov - 2 years ago 72
SQL Question

Stuck again with loading UTF-8 Chars

LOL I am stuck again with this utf-8 loading. Last time someone told me when you load utf-8 add this

mysql_query('SET NAMES utf8');
but this time its not working. This is the code and some photos:

<?php } else {?>
<form action = "" method = "post">
<div class = "tablatekst">
$korisniklog = mysql_fetch_array(mysql_query("SELECT * FROM `korisnici` WHERE `Ime` = '$klogiran'"));
if($korisniklog == '0')
$logiran = false;
header("Location: index.php");
mysql_query('SET NAMES utf8');
$imeprezimelog = $korisniklog['ImePrezime'];
Добредојдовте назад <?php echo $imeprezimelog; ?>
<center><input type="submit" name="odjava" value="Одјави се" class = "loginboxovi"/></center>

<?php } ?>

This is the row in mysql:
And this is how it shows on web:

Answer Source

You are calling it in the inverted order:

mysql_query('SET NAMES utf8');

needs to be before your query, other ways you get the characters back in the default encoding.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download