0
當我嘗試在我的網站上註冊時出現此錯誤嚴格標準:只有變量應該通過引用傳遞。你能看到我的代碼有什麼問題嗎?PHP-PDO只有變量應通過引用傳遞
public static function create(user $user){
$conn= DataBase::getDB();
$stmt=$conn->prepare("INSERT INTO `institute`.`user` (`id`, `name`, `surname`, `username`, `password`, `email`, `registration_number`) "
. "VALUES ('', :name, :surname, :username, :password, :email, :registration_number)");
$stmt->bindParam(':name', $user->getName());
$stmt->bindParam(':surname', $user->getSurname());
$stmt->bindParam(':username', $user->getUsername());
$stmt->bindParam(':password', $user->getpassword());
$stmt->bindParam(':email', $user->getEmail());
$stmt->bindParam(':registration_number', $user->getRegistration_number());
$stmt->execute();
}
簡單,'bindParam()'第二arg是一個參考。你傳遞一個方法結果。你可能想'bindValue()'http://php.net/manual/en/pdostatement.bindvalue.php – AbraCadaver