您好,欢迎访问一九零五行业门户网

php文件中的sql的分割问题

$query='select * from authorized_users where name= '.$userid.' and password=sha1('.$password.')';
这样写对吗?
回复讨论(解决方案) 字符串是用单引号括起来的
$query='select * from authorized_users where name= '.$userid.' and password=sha1('.$password.')';
这样写对吗?
$query=select * from authorized_users where name= '$userid' and password='{sha1($password)}';
$query='select * from authorized_users where name= '.$userid.' and password=sha1('.$password.')';
语法正确,但可读性不强
$query=select * from authorized_users where name='$userid' and password=sha1('$password');
这样是不是清爽些?
你们说的对的,我是初学,结果表名写错了。sorry!!!!
其它类似信息

推荐信息