If you are using the php mysql functions (not an abstraction layer like pear) you can use mysql_insert_id() to get the last ID. It is not the same query but easy.
Also, using your "order by id desc limit 1" can cause problems. It is possible that another user inserted a record right after you so you would get the wrong ID. Use this query instead "SELECT last_insert_id()". This will return the ID generated from the previous insert statement on your connection