I can't figure out why I keep getting this error: Call to a member function bind_param() on a non-object on line 26
Can someone help me? I don't use PHP often.
<?php
$guests = $_POST['guests'];
$organizations = $_POST['organizations'];
$email = $_POST['email'];
$team = $_POST['team'];
if (trim($email) == "") {
include("blank_email.php");
exit(0);
}
$mysqli = new mysqli("localhost", "username", "******", "signin_database");
function error_page($title, $description, $errmsg) {
include("error.php");
}
function thankyou($email) {
include("thankyou.php");
}
if ($mysqli->connect_errno) {
error_page("Cannot Connect", "Cannot connect to database", $mysqli->connect_error);
}
else {
$stmt = $mysqli->prepare("INSERT INTO user_input (guests, organizations, email, team, timestamp) VALUES (?, ?, ?, ?, NOW());");
$stmt->bind_param("isss", $guests, $organizations, $email, $team);
if (!$stmt->execute()) {
error_page("Could not Add", "Could not add email and comment", $stmt->error);
}
else {
thankyou($email);
}
$stmt->close();
$mysqli->close();
}
?>