可能重复:
php/MySQL 插入行然后获取 'id'
如何使用 INSERT INTO 获取当前 ID 号?
mysql_query("INSERT INTO mytable(id,a,b) VALUES(null,3,current ID) ");
mysql_query("
INSERT INTO tablo(id,a,b)
VALUES(null,3,this ID number)
^ ^
| |
| <Copy ID> |
|____________|
");