Answer the question
In order to leave comments, you need to log in
How to select last updated or added row in mysql database?
Maybe LAST_INSERT_ID() . But for some reason this construction does not work for me:
SELECT * FROM `item` WHERE `id` = LAST_INSERT_ID();
Answer the question
In order to leave comments, you need to log in
SELECT * FROM item ORDER BY id DESC LIMIT 1
If id is an increment, output the last row added.
If you need to display the last modified line, then you need to add the updated field, in which to write the time of the change. And then, by analogy with the example above, only sorting by modification date.
Can without addition of an additional column it is possible to do?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question