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