You need to show us how your
method was doing. Essentially, you just need to update your SQL query to get the latest record by doing either:
SELECT TOP 1 * FROM [TABLENAME] ORDER BY id DESC
You can also use the Posted Date to get the latest record. That really depends on you.