However pay attention to this...
mysql_insert_id() converts the return type of the native MySQL C API function mysql_insert_id() to a type of long. If your AUTO_INCREMENT column has a column type of BIGINT, the value returned by mysql_insert_id() will be incorrect. Instead, use the internal MySQL SQL function LAST_INSERT_ID().
so in mysql u would have to query like that:
mysql> SELECT LAST_INSERT_ID()