← All built-ins / mysql_insert_id()
mysql_insert_id()
mysql_insert_id(...$args): int
Parameters
| Name | Type | Description |
|---|---|---|
| $conn | resource | connection handle |
Return value
AUTO_INCREMENT value of the last INSERT on this connection.
Example
echo "id = mysql_insert_id($c); // after an INSERT";
id = mysql_insert_id($c); // after an INSERT
This call needs a real environment (window, server, database or stdin) — the snippet above shows the typical usage shape.