Get Last Entry in a MySQL table

mysql, php

Solution

To get the greatest id:

SELECT MAX(id) FROM mytable

Then to get the row:

SELECT * FROM mytable WHERE id = ???

Or, you could do it all in one query:

SELECT * FROM mytable ORDER BY id DESC LIMIT 1

Problem

I'm basically trying to make a "goal" bar. The goal is determined by getting the last entry I made in a MySQL table. I want to get the ID of the last entry therefore. How do I get the last entry in the table and then get the id from that last entry? (Using PHP)

Original source