....

order by id desc
limit 1

si presume che hai un id autoincrement