Skip to main content

How to get last insert id in joomla 2.5 ?

If you are using Jtable then
$tbl_people = & $this->getTable('People', 'ParichayTable', array());
$tbl_people->name = $data['name'];
$tbl_people->save();
$tbl_people->id; //last insert id
if you are using direct Query then. $db =& JFactory::getDBO();
$db->setQuery( $query );
$db->query();
To get the last insert id:
$db->insertid();

Comments

Post a Comment

Popular posts from this blog

HTML Emailing in ZF2

<?php namespace Application\Model; use Zend\Mail\Message; use Zend\Mime\Message as MimeMessage; use Zend\Mime\Part as MimePart; use Zend\Mail\Transport\Sendmail as SendmailTransport; use Zend\Mail\Transport\Smtp as SmtpTransport; use Zend\Mail\Transport\SmtpOptions; use Zend\View\Renderer\PhpRenderer; use Zend\View\Resolver\TemplatePathStack; use Zend\View\Model\ViewModel; use Zend\View\Model\ModelInterface; class ApiEmail extends ApiInterface {    protected $From = "XXXXX@gmail.com";    protected $FromName = "XXXX";    protected $To = "" ;    protected $Subject = "" ;    protected $Body = "" ;    protected $Cc = "XXXXXX@gmail.com";    protected $Bcc = "XXXXX@gmail.com" ;    protected $ReplyTo = "XXXX@gmail.com" ;    protected $Sender = "" ;    protected $Encoding = "UTF-8" ;    protected $MESSAGE ; // getter setter ...

CMS Integration

·        CMS Driven Approach ·        Technical Considerations ·        The UserConnectModule ·        Passwords ·        Entity Attributes ·        Dealing with Legacy Attributes ·        Registration ·        Synchronizing Sessions ·        Magento Listeners ·        CMS Sessions ·        Shared Themes ·        Store Driven Integration