mysql_insert_id

mysql_insert_id -- Get the id generated from the previous INSERT operation

Description

int mysql_insert_id ( [resource link_identifier])

הערה :

אזהרה

דוגמה 1 . mysql_insert_id Example

 
?php

 
mysql_connect(

 
"localhost"

 
,

 
"mysql_user"

 
,

 
"mysql_password"

 
)

 
or

 
die("could

 
not

 
connect")

 
;

 
mysql_select_db("mydb")

 
;

 
mysql_query("INSERT

 
INTO

 
mytable

 
(product

 
)

 
values

 
('kossu')")

 
;

 
printf

 
("Last

 
inserted

 
record

 
has

 
id

 
%d\n"

 
,

 
mysql_insert_id())

 
;

 
?