I have some php code which inserts a new record into an mysql table. The primary key of the table is auto incremented in mysql. The problem is i need the value of said primary key to use in the php script. This is the insert query Code:...
I have some php code which inserts a new record into an mysql table. The primary key of the table is auto incremented in mysql.
The problem is i need the value of said primary key to use in the php script.
This is the insert query
Code:
$query = "INSERT INTO pages (page_name, qtype, mod_date) VALUES ('".$_GET['qname']."','".$_GET['qtype_id']."','".date(c)."')";
mysql_query($query);
The primary key is the field
page_id which is auto incremented by mysql. This is the value i need.
Thanks