MySQL inserting row + rows at a time in to two tables probs

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
harsha
Forum Contributor
Posts: 103
Joined: Thu Jul 11, 2002 1:35 am
Location: Bengaluru (Bangalore) > Karnataka > India

MySQL inserting row + rows at a time in to two tables probs

Post by harsha »

I have two tables

Submission

and file_info


when I insert a row in to the Submission Table a sub_id is generated automatically and as soon as I insert a row

I am trying to insert some rows in to file_info which Has a column called sub_id

and I have difficulty in getting the sub_id as soon as the row is inserted so that I can use that in the file_info table

is there any thing called as Select sub_id on inserting the row Blah blah..
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

assuming your sub_id column is an auto_increment field, you can get the so generated sub_id by calling function mysql_insert_id()
Post Reply