auto_increment PK help!
Posted: Thu Jan 20, 2005 2:52 pm
hi guys,
i was wondering if some could help me with some codeing/query in this script.
i am inserting some details to start with.
there is also the feild s_id which is the PK and is a auto_increment.
then the next page i want to select or pass over the s_id and insert it as a FK.
but the problem is how can i select the s_id that was just created on the next page?
is there a easy way? normally i would post it over but since mysql is auto creating it i dont have control over it.
first time using the PK thats a auto number on the next page, just getting confused if someone could help me that would be great!
i was wondering if some could help me with some codeing/query in this script.
i am inserting some details to start with.
Code: Select all
$s_title = $_POSTї"txt_title"];
$s_intro = $_POSTї"txt_intro"];
$s_footer = $_POSTї"txt_footer"];
$sql = "INSERT INTO tbl_survey (s_title,s_intro,s_footer) VALUES ('$s_title','$s_intro','$s_footer')";then the next page i want to select or pass over the s_id and insert it as a FK.
but the problem is how can i select the s_id that was just created on the next page?
is there a easy way? normally i would post it over but since mysql is auto creating it i dont have control over it.
first time using the PK thats a auto number on the next page, just getting confused if someone could help me that would be great!