如果ID是字符的,则必须写成
...... where uid = '".$userid."'";
数字的则可以不写单引号 where uid = ".$userid;即可

解决方案 »

  1.   

    不管是数字还是什么,一句$sql="select * from table where uid=$userid";就搞定了,哪有那么麻烦,你以为是C?
      

  2.   

    $sql="select * from table where uid=\"$userid\"";enjoy
      

  3.   

    hsboy这是个sql语言的问题了,在sql语言中,字符串好象必须用单引号括起来的吧~~
      

  4.   

    $sql="select * from table where uid='$userid'";
      

  5.   

    我觉得$userid好像是数字,所以不用加引号。
      

  6.   

    这么简单的问题:(标准格式)
    $sql = "select * from table where uid='$userid'";
    不要管其中的类型
      

  7.   

    我觉得liyujie2000(walker)的方法最好用,还有就是宇凡的也对。其他的嘛,好象有点问题。
      

  8.   

    $sql = "select * from table where uid='$userid'";
    如果$userid含有' " 則需$userid = addslashes($userid)