準備更新我看了PHP手冊了一個多小時,並試圖谷歌的答案,但無濟於事:(什麼是錯我的代碼 - 在PHP
$stmt = $mysqli->prepare("UPDATE players SET energy=:energy, confidence=:confidence, morale=:morale WHERE playerID=:playerID ");
$stmt->bindParam(':energy', $energy);
$stmt->bindParam(':confidence', $confidence);
$stmt->bindParam(':morale', $morale);
$stmt->bindParam(':playerID', $playerID);
$playerID=1;
$energy = 1000;
$confidence = 1100;
$morale = 1200;
$stmt->execute();
但是當我嘗試運行它我收到以下錯誤
Fatal error: Call to a member function prepare() on a non-object in /home/www/websites/www.cricket.cliftonbazaar.com/gm/rungame/rungame.php on line 136
注意線136是準備線路
編輯:所有的變量和表名是正確的,他們一直在三重檢查
檢查是否啓用PDO – Gowri
請將您的代碼發佈到/創建$ mysqli – breiti
您應該以'var_dump'ing'$ mysqli'開頭,PHP認爲它不是一個對象。 – soulmerge