真是崩溃了..php代码出错求解
functionlogin($username,$password){$connect=db_connect_userauth();(这个函数经过注册步骤的验证已经没错)...
function login($username, $password)
{
$connect = db_connect_userauth();(这个函数经过注册步骤的验证已经没错)
$result = $connnect->query("select * from user //问题的line 8
where (username = '".$username."' or userID = '".$username."')
and password = sha1('".$password."')");
报错:
Notice: Use of undefined constant result - assumed 'result' in
D:\xampp\htdocs\test\php\db_connect.php on line
6
Notice: Undefined variable: connnect in
D:\xampp\htdocs\test\php\login_with_db.php on line
8
Fatal error: Call to a member function query() on a
non-object in D:\xampp\htdocs\test\php\login_with_db.php on line 8
求解.....真是找不到....
function db_connect_userauth()
{
$result = new mysqli('localhost', 'user', 'password', 'database');
if(!result)
{
throw new Exception(略写不下)
}
return $result;
} 展开
{
$connect = db_connect_userauth();(这个函数经过注册步骤的验证已经没错)
$result = $connnect->query("select * from user //问题的line 8
where (username = '".$username."' or userID = '".$username."')
and password = sha1('".$password."')");
报错:
Notice: Use of undefined constant result - assumed 'result' in
D:\xampp\htdocs\test\php\db_connect.php on line
6
Notice: Undefined variable: connnect in
D:\xampp\htdocs\test\php\login_with_db.php on line
8
Fatal error: Call to a member function query() on a
non-object in D:\xampp\htdocs\test\php\login_with_db.php on line 8
求解.....真是找不到....
function db_connect_userauth()
{
$result = new mysqli('localhost', 'user', 'password', 'database');
if(!result)
{
throw new Exception(略写不下)
}
return $result;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询