I have a mysql database and I want to get the last ID from a field in a table.
example: -
id Value 1 david 2 jone 3 chris
I need a return 3 function if this table exists.
If you want to select the identifier of the last inserted row in the table with the AUTO_INCREMENT column, you will be interested to know MySQL LAST_INSERT_ID .
You can use:
SELECT MAX(id) FROM table
SELECT id FROM table ORDER BY id DESC LIMIT 1
::
$lastId = mysql_insert_id();
SELECT * FROM table ORDER BY id DESC LIMIT 1