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
I know a non-object error in this setup probably means my sql is bad, but I am having trouble seeing the error.