0

I am stuck with this utf-8 loading. Previously, when loading utf-8 adding this mysql_query('SET NAMES utf8'); worked but this time its not working. This is the code and some photos:

<?php } else {?>
    <form action = "" method = "post">
        <div class = "tablatekst">
            <?php
                $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>
        </div>
    </form>

<?php } ?>

This is the row in mysql: http://prntscr.com/b1buxq And this is how it shows on web: http://prntscr.com/b1bv4h

nosh
  • 600
  • 4
  • 16
Ile Popivanov
  • 95
  • 1
  • 1
  • 7

1 Answers1

0

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.

chris85
  • 23,846
  • 7
  • 34
  • 51