0

我已经使用 utf8_unicode_ci 对我的两个数据库的所有字段进行排序。对于英语和数字很好,但对于泰语它没有显示。它只显示 null。我尝试做很多方法但仍然。但如果我删除$dbh2 这是完美的工作,但我需要两者

<?php    
$timezone = "Asia/Bangkok";  
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);

$dbh1 = mysql_connect('localhost','user1','pass1', true);
$dbh2 = mysql_connect('localhost','user2','pass2', true);

mysql_query("SET NAMES 'utf8");
mysql_select_db('DB1', $dbh1); 
mysql_select_db('DB2', $dbh2);

$name=$_GET['name'];
$data=array();

$search=mysql_query("SELECT * FROM `users` WHERE `uname` = '".$name."'",$dbh2);


    while($a=mysql_fetch_assoc($search))
    {
        $data[]=$a['total_point'];
    }  

    $find=mysql_query("SELECT * FROM  `item` order by `item_id` DESC",$dbh1);
     while($r=mysql_fetch_assoc($find))
     {
          $data[]=$r;
      }


     echo json_encode($data);

?>

输出是这个

    [ "0",
        {
            "item_id": "10",
            "item_band": "Gift Card",
            "item_pic": "http://www.puncorp.com/Applications/GuruLotto/Lotto/card_04.png",
            "item_title": "Gift Card",
            "item_detail": null,
            "item_introduction": null,
            "item_point": "30000",
            "item_point_bg": "0",
            "item_available": "97",
            "item_rule": null,
            "item_expired": "30/12/2556",
            "item_confirm_deal": null,
            "item_confirm_use": null,
            "item_image_total": "10",
            "item_image1": "http://www.puncorp.com/Applications/GuruLotto/Lotto/card_04.png", 
            "status": "6"
        }
    ]
4

0 回答 0