簡體   English   中英

使用PHP將mysql /土耳其語/波蘭語字母插入mysql數據庫時遇到問題

[英]Having problems inserting Greek/Turkish/Polish letters into mysql database with PHP

我正在從經過utf8_unicode_ci編碼的表中讀取單詞Αθήνα ,並且可以在utf-8 HTML頁面上毫無問題地顯示它。 我刮了一些希臘,這也正確顯示。 現在我想將信息寫回到另一個utf8表中的數據庫。 但結果是這樣的: ????? Î?θήνα (當我在上面使用utf8_encode()時)。 我也設定

$this -> mysqli->set_charset("utf8");

我在做什么錯,這讓我發瘋了? 任何幫助表示感謝!

它基本上

讀出:

    $result = $this -> mysqli->query("SELECT * FROM `A` WHERE `country_code` = 'GRC'");
    /* Tell browser to use UTF-8 */
    header("Content-Type: text/html; charset=utf-8");
    /* The actual scrape loop, done for every found entry in the urls table*/
    while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
       $this -> urls_array[] = $row;
    }

回寫:

$deal=$this -> urls_array[$key];
$this -> mysqli->query("INSERT INTO `B` (`city_name`,`title`....) 
        VALUES (
            '{$deal["city_name"]}',
            '{$title}'
            )
            ");

插入任何內容之前,請嘗試執行“ SET NAMES utf8”。 有一種現代的方法可以執行此操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM