references:joomla.framework:database:jdatabase-insertidinsertid
Gets the ID generated from the previous INSERT operation. This method is a wrapper for the database specific method. Syntaxinteger insertid () ExamplesThis example creates a new, default record in the users table and returns the unique id allocated to that user. Example $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: Result 2
Discussion |


