1

i can't get kanji character outside MySQL, kanjis are shown from phpmyadmin normally but when dragged out into variable it can't, they became ???, already try to add

          <meta charset=utf-8 /> 

but still doesn't work. here's part of my code

    <?php
        include_once('class/word.php');
        include_once('conn/connection.php');
        $conn = get_koneksi();
        $sql = "SELECT * FROM tb WHERE id=? LIMIT 1";
                $stm= $conn -> prepare($sql);
        $stm -> bindParam(1, $_REQUEST['id']);
        $stm-> execute();
        if ($stm-> rowCount() > 0) {
            $row = $stm-> fetch();
          #this result nothing
            echo "<script>alert(".$row['kanji'].");</script>";
           $item = new word($row['id'],$row['word'],$row['kanji'],$row['length']);
          #this result undefined -> $item->getKanji() is blank in alert
            echo "<script>alert(".$item->getKanji().");</script>";
          #this result ???? character instead kanjis
          echo "<div style='width:700px;position:absolute;'><h1>".$item->getKanji()."</h1></div>";
        }else echo "No Data Found !";
    ?>

How to solve this still in PDO usage ?

code-addict
  • 137
  • 2
  • 12

0 Answers0