I'm creating a Login and Register Form that sends data into the database.
I'm getting an error which states
Fatal error: Uncaught Error: Call to a member function bind_param() on bool in E:\xampp\htdocs\Website\Login\insert.php:12 Stack trace: #0 {main} thrown in E:\xampp\htdocs\Website\Login\insert.php on line 12
Here's the code
<?php
$Username = $_POST['Username'];
$password = $_POST['Password'];
// Database connection
$conn = new mysqli('localhost','root','Dec@2007','loginsystem');
if($conn->connect_error){
echo "$conn->connect_error";
die("Connection Failed : ". $conn->connect_error);
} else {
$stmt = $conn->prepare("insert into users(Username, Password) values(?, ?, ?)");
$stmt->bind_param("ss", $Username, $Password);
$execval = $stmt->execute();
echo $execval;
echo "Registration successfully...";
$stmt->close();
$conn->close();
}
I'm pretty sure the problem is not with HTML.