0

I created a program with lua on Autoplay Media Studio 8.5 and send some data to MySQL database

My database collation is utf8_unicode_ci and when i send data whit AMS it saved on table like this : ÓáÇã Çíä í˜ ÊÓÊ ÇÓÊ

When I use AMS to SELECT data and show there is no problem.

but I want to create a web page with php and SELECT data. In this case characters shows still like this : ÓáÇã Çíä í˜ ÊÓÊ ÇÓÊ

I use this code on my php file :

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
    </head>
    <body>
        <?php
            $db_path = "localhost";
            $db_name = "mydb";
            $db_user = "root";
            $db_pass = "";

            $conn = mysqli_connect($db_path, $db_user, $db_pass, $db_name);
            if ($conn->connect_error) {die("Connection failed: " . $conn->connect_error);}

            mysqli_set_charset($conn, 'cp1256');

            $sql = "SELECT * FROM mytable ORDER BY id DESC LIMIT 5";

            $res = mysqli_query($conn, $sql);
            while($row = mysqli_fetch_assoc($res)){echo $row['col1']}

            mysqli_close($conn);

        ?>
    </body>
</html>     
S R R
  • 73
  • 8

0 Answers0