PHP。 Mysql - 方法不更新mysql行

I m not sure why this method is not updating the pending row in items

| Field         | Type         | Null | Key | Default     | Extra
| pending       | int(1)       | YES  |     | NULL        |

function:

private function setPendingWin($item_id)
{
    var_dump($item_id);
    if($q = $this->db->mysqli->prepare("UPDATE items SET pending = 1 WHERE id = ?"))
    {
        $q->bind_param("i", $item_id);
        $q->execute();
        $a_r = $q->affected_rows;
        $q->close();

        return $a_r;
    }
        return false;
}

What if you just say UPDATE items SET pending = 1? does it work? If yes then check your where condition. I am trying to point out that the where condition WHERE id = ? doesn't matches any record and so no update is happening.

If you want to validate the same then perform a SELECT query with same condition and see how many records does it fetches

SELECT * from items WHERE id = ?