Signature
u64 mysql_insert_id(MySQL* m)
Parameters
m : pointer to an active MySQL connection
return value : the last used automatic row ID
Returns the last automatically assigned row ID used by the current MySQL connection.
This is typically used after an INSERT into a table with an AUTO_INCREMENT primary key.
Example
MySQL* db = mysql_connect();
if(db != 0)
{
DValue row = mysql_query(db, "select last_insert_id() as id");
print("mysql_insert_id() returns the last AUTO_INCREMENT id for this connection (currently ", mysql_insert_id(db), ")\n");
mysql_disconnect(db);
}
else print("(requires a reachable MySQL server)\n");
Output
mysql_insert_id() returns the last AUTO_INCREMENT id for this connection (currently 0)