0
public function endGame($result) {
$sql = "UPDATE games SET result = ? WHERE id = ?";
$stmt = $this->db->prepare($sql);
$stmt->bind_param("si", $result, $this->currentGame);//Error here
$stmt->execute();
$stmt->close();
}
mysql> describe games;
+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| name | varchar(20) | NO | | NULL | |
| date_played | datetime | NO | | NULL | |
| difficulty | tinyint(4) | YES | | NULL | |
| result | varchar(20) | NO | | NULL | |
+-------------+-------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
Fatal error: Call to a member function bind_param() on a non-object
我知道这个设置中的非对象错误可能意味着我的sql很糟糕,但我无法看到错误。准备声明:调用非对象上的成员函数
在哪一行发生错误? – deceze 2010-10-18 08:04:10
在bind_param上 – TehNatha 2010-10-18 08:08:57
这可能意味着你的'prepare'没有成功,'$ stmt'未定义 – Andomar 2010-10-18 08:16:08