解决方案 »

  1.   

    你的程序是什么编码的?
    你的 city 字段是什么编码的?以下是几种可能的情况
    1、程序是 gbk 的,city 是 utf8 的 需要在查询前 mysql_query(/set names gbk');
    2、程序是 utf-8 的,city 是 gbk 的 需要在查询前 mysql_query(/set names utf8');
    3、最坏的情况:city 没有设置编码,且程序是 utf-8 的
    此时需要 
    $w = iconv('utf-8', 'latin1', '广东');
    $sql="SELECT `cityid` FROM `weathercityid` where `city`='$w'";取回的数据还需反编码
      

  2.   

    把文件另存为utf-8,mysql查询的时候设置mysql_query('set names utf8');
    mysql识别不了编码所以查不出