I can not for the life of me figure out why these errors are occuring. Both of them are showing up. The form I have setup will not insert the data into my database. I have almost the exact same code setup on other pages and it works just fine. I must be missing something minor :\ Any help is greatly appreciated. First are the errors and next is the code. Thanks
Code:
Warning: mysqli_stmt_init() expects parameter 1 to be mysqli, boolean given in /home/rexburgd/public_html/submitdate.php on line 41
Warning: mysqli_stmt_prepare() expects parameter 1 to be mysqli_stmt, null given in /home/rexburgd/public_html/submitdate.php on line 43
PHP Code:
$datetitle=$_POST['datename'];
$imageurl=$_POST['imagelink'];
$datedetails=$_POST['datedetails'];
$intfacts=$_POST['interestingfacts'];
$directions=$_POST['directions'];
$tips=$_POST['tips'];
$category=$_POST['category'];
$rex_approval="0";
$server = "localhost";
$username = "removed";
$password = "removed";
$database = "removed";
$db = @mysqli_connect($server, $username, $password, $database);
$stmt = mysqli_stmt_init($db);
$sql = "INSERT INTO dates(rex_category,rex_title,rex_details,rex_facts,rex_directions,rex_tips,rex_url,rex_approval) values (?,?,?,?,?,?,?,?)";
if(mysqli_stmt_prepare($stmt, $sql))
{
mysqli_stmt_bind_param($stmt, "issssssi", $category,$datetitle,$datedetails,$intfacts,$directions,$tips,$imageurl,$rex_approval);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
mysqli_close($db);
}