$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;
This returns error
Fatal error: Call to a member function bindParam() on a non-object
with the line reffering to the line number 2 shown.
$setEndedDate->bindParam(":date", date_format($date, 'Y-m-d H:i:s'));
Not sure why I'm getting the error.