数据表php_area字段areaid,name 
获取areaid=2,name的值麻烦知道的大哥给完整的代码,谢谢了

解决方案 »

  1.   

    mysql_connect("localhost",'用户名','密码');
    mysql_select_db('库名');
    $r=mysql_query("select name from php_area where areaid=2");
    $row=mysql_fetch_row($r);   //如果areaid 不唯一,此处加上while循环
    echo $row[0];
      

  2.   

    编码是什么?
    $r=mysql_query("select name from php_area where areaid=2");
    之前加上mysql_query("SET NAMES 'gbk'"); //GBK 或者 UTF8