大家好,今天做了个PHP脚本,其中SELECT username  age where username = '$username';
其中$username是用表单提交过来的。现在的问题是当用户名是数字的时候没有问题,但是当表单提的用户名包含字母就不对了。
错误的提示是:unknow 列 '0102ff03' where ...(用户名为0102ff03) 不知道问题出在哪里,着急啊,明天就要验证了,晚上不睡觉在线等大家的帮助,真的非常感谢!!!!!!

解决方案 »

  1.   

    sql="SELECT   username     age   where   username   =   '".$username."'";
      

  2.   

    楼主是不是掉了表名 
    如果 username 是字符型 楼上的在加个表名就OK了sql="SELECT   username     age from tableName where   username   =   '".$username."'";
      

  3.   

    这是查找usernamet和age两个字段
    sql="SELECT username,age from tableName where username = '".$username."'";
    这是把username改名为age,只查找字段username,age为username的别名sql="SELECT   username age from tableName where   username   =   '".$username."'";
      

  4.   

    sql="SELECT   username,age from tableName where   username   =   '".$username."'";
      

  5.   

    sql="SELECT username,age from tableName where   username = '".$username."'";