|
|
Home Developer Manual 11. API Reference [REVIEW] database->insertid |
| [REVIEW] database->insertid |
|
|
|
|
Last reviewed: Not reviewed database->insertidReturns the unique record number of the last record to be inserted into a database table. Syntaxint insertid ( ) ExamplesExample: This example creates a new, default record in the users table and returns the unique id allocated to that user. // Returns unique id of new user record or false // if the insert failed. function newUser() { global $database; $sql = 'INSERT INTO #__users () VALUES()'; $database->setQuery( $sql ); if (!$database->query()) { echo $database->stderr(); return false; } return $database->insertid(); } Please report any errors on this page to the Developer Documentation Forum. |
|
| Last Updated ( Sunday, 24 December 2006 ) |
| < Prev | Next > |
|---|





