不好意思,打错了,是有的,更正下 $sql="select * from use where username="$username" and password="$password";";
$sql="select * from where username="$username" and password="$password";"; from后面没有表名 $sql="select * from where username=".$username." and password=".$password.";"; 连接字符串用“.”,如果还是不行看看数据库连接有没有问题
$sql="select * from use where username='$username' and password='$password';";
那你把提交的sql语句打印出来,在写到数据库里测试一下,看看错误代码不就行了
谢谢你的回答,from后面的表名已经加进去了, $sql="select * from use where username=".$username." and password=".$password.";"; 数据库连接也没问题 ,现在提示是sql语法有错,晕死,You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'use where username=aaa and password=' at line 1
from后面没有表名
$sql="select * from where username=".$username." and password=".$password.";";
连接字符串用“.”,如果还是不行看看数据库连接有没有问题
谢谢你的回答,from后面的表名已经加进去了,
$sql="select * from use where username=".$username." and password=".$password.";";
数据库连接也没问题 ,现在提示是sql语法有错,晕死,You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'use where username=aaa and password=' at line 1
表名不能用USE
AND `password` = CONVERT( _utf8 '123'USING gbk ) COLLATE gbk_chinese_ci
,然后我把里面的‘aaa’和‘123’换成'$username'和'$password'来代替,那么sql语句变成
$sql="SELECT * FROM `use` WHERE `username` = CONVERT( _utf8 '$username'USING gb2312 )
COLLATE gb2312_chinese_ciAND `password` = CONVERT( _utf8 '$password'USING gbk ) COLLATE gbk_chinese_ci";
可是还是提示语法错误,
晕死一个早上都在搞这个了,大家在帮帮忙啊。
为什么表明不能勇USE啊?
表名use确实不能勇‘use’这个形式,我以为加单引号或者不加都可以,其实应该用table键上面那个键,就是`这个键,呵呵,不过我还是不明白,为什么不能勇单引号呢