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')";
这样是不是清爽些?