Snippet Name: Get last added insert ID
Description: Get the id of an auto_incrementing id from a mySQL insert.
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: March 01st, 2009
|
<?PHP
// Do your insert query...
mysql_query("INSERT etc...");
// This finds the id of the row once it has been added...
$id = mysql_insert_id();
// Display it...
ECHO $id;
?>
|