I'm trying to get the last row id from a table in MySQL, using PHP and I have the following code:
$query = "SELECT MAX(id) FROM #__djcf_items";
$db->setQuery($query);
$id = $db->loadResult()+1;
And it works, but if I delete last row then that code will return what I want -1...
How can I get the "global" last row id even after deleting row(s)?