I am performing an update to a row dependent on a condition and need to return the ID of the row affected.
This is what I have tried
$update = "UPDATE table_1
SET delete_flag = 1,
id = LAST_INSERT_ID(id)
WHERE other_id = $otherId;
SELECT LAST_INSERT_ID();";
$result = $this->db->query($update);
$result returns nothing
$update = "UPDATE table_1
SET delete_flag = 1
WHERE other_id = $otherId;";
$result = $this->db->query($update);
$id = $this->db->lastInsertId();
$id returns nothing
What am I missing?