I needed to find the max number in my Joomla Database and increment this by one. Here is the code I used that ended up working for me.

// Get the highest ticket number and add 1
$db = JFactory::getDbo();
$query = $db->getQuery(true);
->order(‘number ASC’)
$my_value = $db->loadResult();
// Add 1
$next_num = ($my_value + 1);

I found this link that helped me figure it out.


I hope this helps someone else…