====== insertid ======
{#JAPI Joomla.Framework Database JDatabase::insertid #}
Gets the ID generated from the previous INSERT operation. This method is a wrapper for the database specific method.
===== Syntax =====
integer insertid ()
===== Examples =====
This example creates a new, default record in the users table and returns the unique id allocated to that user.
$database =& JFactory::getDBO();
$sql = 'INSERT INTO #__contact_details (name) VALUES("PEDRO")';
$database->setQuery( $sql );
if (!$database->query()) {
echo $database->stderr();
} else {
echo $database->insertid();
}
might produce:
2
----
~~DISCUSSION~~