我没有看到错误,希望有人能弄清楚:
public static function createMessage($title, $message, $startDate, $endDate, $author, $status){
//$dbConn is now a mysqli instance with a connection to the database foobar
$dbConn = Database::getConnection("foobar");
$stmt = $dbConn->prepare("INSERT into messages(title, msg, date_start, date_end, app_usersID_FK, date_created, activeflag, msg_status) VALUES (?,?,?,?,?,?,?,?)");
if(!$stmt){
throw new Exception("Unable to prepare the statement");
}
$dt = date("Y-m-d");
$stmt->bind_param("ssssisii", $title, $message, $startDate, $endDate, $author, $dt, 1, $status);
$stmt->execute();
return true;
}
函数调用
MessageCenter::createMessage("Hello", "打电话打个招呼", "2009-09-12", "2009-09-12", "1", "1");
错误信息是:
致命错误:无法通过引用传递参数 8