我在下面有一段代码,它使用 mysqli 和 php 将数据插入数据库。问题是我收到一个致命错误,说明:致命错误:无法通过第 116 行的 ... 中的引用传递参数 2
为什么会出现此错误,我该如何解决该错误?
下面是代码:
if ($numrows == 0){
$teacherpassword = md5(md5("j3Jf92".$teacherpassword."D203djS"));
$code = md5(rand());
$insertsql = "
INSERT INTO Teacher
(TeacherId, TeacherForename, TeacherSurname, TeacherEmail, TeacherAlias, TeacherUsername, TeacherPassword, Active, Code)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?)
";
if (!$insert = $mysqli->prepare($insertsql)) {
// Handle errors with prepare operation here
}
$insert->bind_param("sssssssss", '', $getfirstname, $getsurname,
$getemail, $getid, $getuser,
$teacherpassword, '0', $code);
$insert->execute();
if ($insert->errno) {
// Handle query error here
}
$insert->close();