나는이 스크립트를 30 번 이상 사용 했으므로 저의 인생에서 내 문제를 찾을 수 없습니다.PHP 치명적인 오류 : member 함수 bind_param()을 호출하십시오.
function redeem() {
$case = $_POST["case"];
$name = $_POST["name"];
$profession = $_POST["profession"];
$city = $_POST["city"];
$country = $_POST["country"];
$totalpercent = $_POST["totalpercent"];
$pretest = $_POST["pretest"];
$posttest = $_POST["posttest"];
$investigationspercent = $_POST["investigationspercent"];
$timesreset = $_POST["timesreset"];
$creditsspent = $_POST["creditsspent"];
$timescompleted = $_POST["timescompleted"];
//Add the information to the learnent_cases_leaderboard table
$stmt = $this->db->prepare("INSERT INTO learnent_cases_leaderboard (case, name, profession, city, country, totalpercent, pretest, posttest, investigationspercent, creditsspent, timescompleted, timesreset, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)");
$stmt->bind_param("sssssiiiiiii", $case, $name, $profession, $city, $country, $totalpercent, $pretest, $posttest, $investigationspercent, $creditsspent, $timescompleted, $timesreset); //the quotations specify the type of variable;
//See http://php.net/manual/en/mysqli-stmt.bind-param.php for more information on bind_param
$stmt->execute();
$stmt->close();
I 오류 로그를 확인, 그것은 나에게이 오류 메시지가 있습니다 :
라인 (105)이 라인 :
PHP Fatal error: Call to a member function bind_param() on a non-object on line 105
코드 :
$stmt->bind_param("sssssiiiiiii", $case, $name, $profession, $city, $country, $totalpercent, $pretest, $posttest, $investigationspercent, $creditsspent, $timescompleted, $timesreset);
여기에 코드입니다
어쩌면 저는 제 PHP로 녹슬지는 모르지만 $ this-> db가 선언 된 방법을 알아야 할 필요가 있다고 생각합니다. $ this-> db-> prepare는 실제로 객체를 반환하지 않는 것처럼 들립니다. – Kris
[참고 - PHP에서이 오류는 무엇을 의미합니까?] (http://stackoverflow.com/questions/12769982/reference-what-this-error-mean-in-php) –