-1
$setEndedDate = ("UPDATE spaceships_list SET ended = :date WHERE id = :spaceship_id");
$setEndedDate->bindParam(":date", date_format($date, 'Y-m-d H:i:s'));
$setEndedDate->bindParam(":spaceship_id", $row["spaceship_id"]);
$setEnded->execute();
$endFlight = $db->prepare("DELETE FROM flights WHERE spaceship_id = :spaceship_id");
$endFlight->bindParam(":spaceship_id", $row["spaceship_id"]);
continue;
上這將返回錯誤致命錯誤:調用一個成員函數bindParam()的非對象
Fatal error: Call to a member function bindParam() on a non-object
與線reffering於所示的行號2。
$setEndedDate->bindParam(":date", date_format($date, 'Y-m-d H:i:s'));
不知道爲什麼我得到錯誤。
也許是因爲你是一個非對象上調用成員函數(方法)?顯然,$ db-> prepare沒有返回一個對象。 –
[致命錯誤:調用成員函數bindParam()](http://stackoverflow.com/questions/7941089/fatal-error-call-toa-a-member-function-bindparam)或[this ](http://stackoverflow.com/questions/4488035/call-to-a-member-function-bind-param-on-a-non-object)或[this](http://stackoverflow.com/問題/ 18921670/fatal-error-call-to-a-member-function-bind-param-on-a-non-object)或[this](http://stackoverflow.com/questions/18401682/call-成員函數綁定參數非對象) – Kermit
@PavelS。 OP甚至沒有在'$ setEndedDate'上準備' – kero