如何在php的最后一行更新一个值

I just wanted to know how should look my sql query to make an update of one value in the last row of my table. I tried to do this by query which is unfortunately not working:

UPDATE tableName SET food=888 WHERE id=(SELECT MAX(id) FROM tableName)

I tried to use this query instead but it's incorrect aswell:

UPDATE tableName SET food=88 ORDER BY id DESC LIMIT 1

(I missed quotation marks in queries on purpose to make them clearly)

Your 2nd query works, I tested it in sqlfiddle

CREATE TABLE tableName
    (`Id` int, `food` int)
;

INSERT INTO tableName
    (`Id`, `food`)
VALUES
    (1, 8)
;

UPDATE tableName SET food=88 ORDER BY id DESC LIMIT 1;