Nouman Ahmad Khan Nouman Ahmad Khan - 1 year ago 102
MySQL Question

Get last record in mysql using php

How can I SELECT the last row in a MySQL table using php?
I have 3 columns id(AI), longitude and latitude.
DBName: fts
TableName: currentlocation

Thanks for the response guys,
I have acquired right results by using such query
SELECT longitude, latitude FROM currentlocation ORDER BY id DESC LIMIT 1

Answer Source

You can add the following to the end of your query:

order by id desc limit 1


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download