I have mysql database and I want to get the last ID from field in a table .
example : -
id Value
1 david
2 jone
3 chris
you can also use the following code ::
$lastId = mysql_insert_id();
If you want to select the ID of the most recently inserted row in a table with an AUTO_INCREMENT column, you will likey be interested in MySQL's LAST_INSERT_ID function.
SELECT * FROM table ORDER BY id DESC LIMIT 1
You can use:
SELECT MAX(id) FROM table
SELECT id
FROM table
ORDER BY id DESC
LIMIT 1