I would like to get the ID of an item that I recently saved using store-method.

On Joomla 3.4.48 I was able to use this source:

$data['userid'] = $userid;
$data['title'] = $title;                
$data['content'] = $content;

$data['state'] = $state;

// Lets store it!    
$row = JTable::getInstance('Message','BestiaTable');
$store = $row->store(); 

if($store)                        return $row->id;

Now $row->id is always NULL.

How can I change that?


2 Answers 2


The problem is solved. On Joomla 3.5 the PDO driver does not return an id.

This is discussed and will be solved: https://github.com/joomla/joomla-cms/issues/9534


To get the last insertId use:

$newID = $row->insertId();

Here is the documentation You have to call it just after

$store = $row->store(); 
  • Hm, unfortunately this still returns NULL.
    – MyFault
    Commented Mar 26, 2016 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.