PHP MySQL Greek letters showing like ???? marks

后端 未结 6 591
广开言路
广开言路 2020-11-29 08:37

I have a table with some text and text is greek letters, when i use sql tool and select the data from this table is showing correctly

6条回答
  •  北海茫月
    2020-11-29 09:27

    Leaving this here for those who come to this site via Google because they have the same issue but use PDO instead (like me) - you should be fine with:

    $dns = "mysqli:host=localhost;dbname=db_name";
    $pdo = new PDO($dns, 'db_user', 'db_pass',
            array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
    $pdo->exec("SET CHARACTER SET 'utf8'"); 
    

提交回复
热议问题