I am receiving 2 errors in my code below:
Warning: mysqli::prepare() [mysqli.prepare]: (21S01/1136): Column count doesn't match value count at row 1 in ... on line 115
Fatal error: Call to a member function bind_param() on a non-object in ... on line 119
I am using mysqli and php code. What do I need to do in order to fix these errors?
CODE:
$insertsql = "
INSERT INTO Teacher
(TeacherForename, TeacherSurname, TeacherEmail, TeacherAlias, TeacherUsername, TeacherPassword, Code)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?)
";
if (!$insert = $mysqli->prepare($insertsql)) {
// Handle errors with prepare operation here
}
$insert->bind_param("sssssss", $getfirstname, $getsurname,
$getemail, $getid, $getuser,
$teacherpassword, $code);
$insert->execute();
if ($insert->errno) {
// Handle query error here
}
$insert->close();