【发布时间】:2014-02-23 13:36:58
【问题描述】:
$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;
这会返回错误
Fatal error: Call to a member function bindParam() on a non-object
与显示的第 2 行相关的行。
$setEndedDate->bindParam(":date", date_format($date, 'Y-m-d H:i:s'));
不知道为什么会出现错误。
【问题讨论】:
-
可能是因为你在非对象上调用成员函数(方法)?显然,$db->prepare 没有返回对象。
-
@PavelS。 OP甚至没有
prepare$setEndedDate -
哦,开枪。我没有使用 $db->prepare!谢谢!
-
$setEndedDate是字符串,它不是对象。
标签: php