I have a database named "assignmentdb" and i'm using xampp to do my project.
I'm using these codes for my login page for my website. There's an error for line "$stmt->bind_param("s", $userid); "
"Fatal error: Call to a member function bind_param() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/Assignment/loginsuccess.php on line 50"
This is my codes:
$userid = $_POST['userid'];
$password = $_POST['password'];
$mysqli = new mysqli("localhost", "root", null, "assignmentdb");
$stmt = $mysqli->prepare("Select password from forumuser where userid=?");
$stmt->bind_param("s", $userid);
$stmt->execute();
$stmt->bind_result($p);
$stmt->fetch();
$stmt->close();
$mysqli->close();
if($p == $password){
echo '<p>Welcome! You have logged in successfully!</p>';
echo 'Please <a href="comments.html">Click here to continue</a>';
echo "<p><a href='messages(7).php?userid=$userid'>Go To my Messages</a> </p>";
}
else{
echo '<p><h1>Login unsuccessful!</h1>';
}