error_reporting( ~E_NOTICE );
require_once 'includes/connect5.php';
if(isset($_POST['btnsave']))
{
$reserveBy = $_POST['reserveBy'];
$bookId = $_POST['bookId'];// isbn
$bookTitle = $_POST['bookTitle'];// book name
$dateReserve = $_POST['dateReserve'];
if(empty($reserveBy)){
$errMSG = "Please Enter Name.";
}
else if(empty($bookId)){
$errMSG = "Please Enter the BOok ISBN.";
}
else if(empty($bookTitle)){
$errMSG = "Please Enter the Title.";
}
else
{
$stmt = $DB_con->prepare("INSERT INTO reservation(reserveBy,bookId,bookTitle,dateReserve,reserveExp) VALUES(:rrb, :risbn, :rbtit, now(), now() + INTERVAL 3 HOUR)");
$stmt->bindParam(':rrb',$reserveBy);
$stmt->bindParam(':risbn',$bookId);
$stmt->bindParam(':rbtit',$bookTitle);
if($stmt->execute()) // this is the error line it points to this
{
$successMSG = "New Record Successfully Inserted ...";
header("refresh:1;index1.php"); // redirects image view page after a seconds.
}
else
{
$errMSG = "error while inserting....";
}
}
}
?>
I dont know why and how is has produced an error! It's pointing to the line:
if($stmt->execute())
It says:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in !
I dont understand why is it says number of bound variable does not match number of tokens even my input data is complete. I've searchd it to the internet but no one is similar to my problem.