如题。恳请各位大侠指点,不胜感激。
我在phpwind系统中,直接使用了如下代码查询附件表pw_attachs ,但是在获取附件的url地址时,如果是英文字符串则完全没问题,如果是中文则也会显示中文,但是在正常(即数据库中对应的)字符串之后会多出一个固定的字符,例如分号,或者字母等。
例如 数据库中的字符串为:Mon_1112/2_1_c384ebbec416511测试.mp3
但是查询出来之后就成了Mon_1112/2_1_c384ebbec416511测试.mp3h
后面多了一个字符h,
再例如:Mon_1112/2_1_44a84b056c5ef56小王.mp3
查询之后则多了一个分号:Mon_1112/2_1_44a84b056c5ef56小王.mp3;
另外:phpwind系统编码为GBK,数据库系统为gbk。
相关代码如下:<?php
    $mydb="db";
         $conn = @mysql_connect("localhost","name","mima") or die("数据库连接失败");
         mysql_select_db($mydb);
         mysql_query("set names 'GBK'",$conn); //设置使用GBK中文编码
         $result=mysql_query("select * from pw_attachs ;",$conn);
         if($result)
         {
             while($row=mysql_fetch_array($result)){
                 echo  $row['aid']."<Br>";
                 echo $row['attachurl']."<Br>";
             }
         }else
            echo "the result is null";
?>  

解决方案 »

  1.   

    请贴出 pw_attachs 表信息
      

  2.   

    Field Name Field Type Size Precision Not Null Default Comment 
    aid INTEGER 10 0 True Null   
    attachurl VARCHAR 80 0 True 0   
    ctype VARCHAR 20 0 True ''   
    descrip VARCHAR 100 0 True ''   
    did INTEGER 10 0 True 0   
    fid SMALLINT 6 0 True 0   
    hits MEDIUMINT 8 0 True 0   
    ifthumb TINYINT 3 0 True 0   
    mid INTEGER 10 0 True 0   
    name VARCHAR 255 0 True ''   
    needrvrc SMALLINT 6 0 True 0   
    pid INTEGER 10 0 True 0   
    size INTEGER 10 0 True 0   
    special TINYINT 3 0 True 0   
    tid INTEGER 10 0 True 0   
    type VARCHAR 30 0 True ''   
    uid INTEGER 10 0 True 0   
    uploadtime INTEGER 10 0 True 0   
      

  3.   

    Field Name Field Type Size Precision Not Null Default Comment 
    aid INTEGER 10 0 True Null   
    attachurl VARCHAR 80 0 True 0   
    ctype VARCHAR 20 0 True ''   
    descrip VARCHAR 100 0 True ''   
    did INTEGER 10 0 True 0   
    fid SMALLINT 6 0 True 0   
    hits MEDIUMINT 8 0 True 0   
    ifthumb TINYINT 3 0 True 0   
    mid INTEGER 10 0 True 0   
    name VARCHAR 255 0 True ''   
    needrvrc SMALLINT 6 0 True 0   
    pid INTEGER 10 0 True 0   
    size INTEGER 10 0 True 0   
    special TINYINT 3 0 True 0   
    tid INTEGER 10 0 True 0   
    type VARCHAR 30 0 True ''   
    uid INTEGER 10 0 True 0   
    uploadtime INTEGER 10 0 True 0   
    上述为表的信息,我将数据库表导出来发现,记录中的末尾分别多了一个分号和字母h,但是在插入该条记录的时间是没有这个字符的。请大牛指点,谢谢