(PHP 4, PHP 5)
mysql_insert_id — 取锟斤拷锟斤拷一锟斤拷 INSERT 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 ID
$link_identifier
] ) : int
mysql_insert_id()
锟斤拷锟截革拷锟斤拷锟斤拷
link_identifier
锟斤拷锟斤拷一锟斤拷 INSERT 锟斤拷询锟叫诧拷锟斤拷锟斤拷 AUTO_INCREMENT 锟斤拷 ID 锟脚★拷锟斤拷锟矫伙拷锟街革拷锟�
link_identifier
锟斤拷锟斤拷使锟斤拷锟斤拷一锟斤拷锟津开碉拷锟斤拷锟接★拷
锟斤拷锟斤拷锟揭伙拷锟窖伙拷胁锟斤拷锟� AUTO_INCREMENT 锟斤拷值锟斤拷锟斤拷 mysql_insert_id() 锟斤拷锟斤拷 0锟斤拷锟斤拷锟斤拷锟揭拷锟斤拷锟斤拷值锟皆猴拷使锟矫o拷要确锟斤拷锟节诧拷锟斤拷锟斤拷值锟侥诧拷询之锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 mysql_insert_id()锟斤拷
Note:
MySQL 锟叫碉拷 SQL 锟斤拷锟斤拷 LAST_INSERT_ID() 锟斤拷锟角憋拷锟斤拷锟斤拷锟斤拷锟铰诧拷锟斤拷锟斤拷 AUTO_INCREMENT 值锟斤拷锟斤拷锟揭诧拷锟斤拷锟节诧拷询锟斤拷锟街拷浔伙拷锟斤拷谩锟�
mysql_insert_id() 锟斤拷 MySQL 锟节诧拷锟斤拷 C API 锟斤拷锟斤拷 mysql_insert_id() 锟侥凤拷锟斤拷值转锟斤拷锟斤拷 long锟斤拷PHP 锟斤拷锟斤拷锟斤拷为 int锟斤拷锟斤拷锟斤拷锟� AUTO_INCREMENT 锟斤拷锟叫碉拷锟斤拷锟斤拷锟斤拷 BIGINT锟斤拷锟斤拷 mysql_insert_id() 锟斤拷锟截碉拷值锟斤拷锟斤拷锟斤拷确锟斤拷锟斤拷锟斤拷锟斤拷 SQL 锟斤拷询锟斤拷锟斤拷 MySQL 锟节诧拷锟斤拷 SQL 锟斤拷锟斤拷 LAST_INSERT_ID() 锟斤拷锟斤拷锟斤拷锟�
Example #1 mysql_insert_id() 锟斤拷锟斤拷
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
mysql_query("INSERT INTO mytable (product) values ('kossu')");
printf ("Last inserted record has id %d\n", mysql_insert_id());
?>
锟轿硷拷 mysql_query()锟斤拷