我确实需要一些帮助来解释我的错误。我对优衣库很陌生,有人能借给我一些时间教我优衣库吗?
<?php
if(isset($_POST['txtlogin'])){
$username = $_POST['txtusername'];
$password = md5($_POST['txtpassword']);
$stmt = $link->prepare("SELECT username, password FROM users WHERE username=? AND password=?");
$stmt->bind_param('ss', $username, $password);
$stmt->execute();
$stmt->bind_result($username, $password);
$stmt->store_result();
if($stmt->num_rows == 1) //To check if the row exists
{
while($stmt->fetch()) //fetching the contents of the row
{$_SESSION['Logged'] = 1;
$_SESSION['username'] = $username;
echo 'Success!';
exit();
}
}
else {
echo "INVALID USERNAME/PASSWORD Combination!";
}
$stmt->close();
}
else
{
}
$link->close();
?>
当您在不使用类的对象的情况下调用类的函数时,会出现问题中引用的错误。
问题是$link
$link
应该是一个mysqli对象,比如:
$link = new mysqli("yourhost", "youruser", "yourpassword", "yourdb");