I always get a response "mysqli_stmt_object is not fully initialized" as output of the code below. But I cannot figure out what the mistake is.
try {
$hashed_passcode = password_hash($password1, PASSWORD_DEFAULT);
require 'mysqli_connect.php';
$query = "INSERT INTO users (userid, first_name, last_name, email, password,
registration_date) ";
$query .= "VALUES(' ', ?, ?, ?, ?, NOW() )";
$q = mysqli_stmt_init($dbcon);
mysqli_stmt_prepare($q, $query);
mysqli_stmt_bind_param($q, 'ssss', $first_name, $last_name, $email, $hashed_passcode);
mysqli_stmt_execute($q);
if (mysqli_stmt_affected_rows($q) == 1) {
header("location: register-thanks.php");
exit();
} else {
$errorstring = "<p class='text-center col-sm-8'
style='color:red'>";
$errorstring .= "System Error<br />You could not be registered due ";
$errorstring .= "to a system error. We apologize for any
inconvenience.</p>";
echo "<p class=' text-center col-sm-2'
style='color:red'>$errorstring</p>";
mysqli_close($dbcon); // Close the database connection.
echo '<footer class="jumbotron text-center col-sm-12"
style="padding-bottom:1px; padding-top:8px;">
include("footer.php");
</footer>';
exit();
}
}