Welcome!

And don't forget to edit your signature & profile.

 

Icon

Statistics

  • Total posts 23318
  • Total topics 4049
  • Total members 5574
  • Our newest member
    ALF5583

TOP POSTERS

2 forms and 2 joined tables

All problems and developments related to PHP, Ruby on Rails & Co. are discussed and resolved here.
   

2 forms and 2 joined tables

Postby silvercover » Wed Nov 04, 2009 5:44 pm

Hi,

I have 2 related forms connected to 2 joined tables. what I want to know is that how can I code to insert submitted forms in joined tables with the same auto incremented value as a primary key for main table and foreign key for joined table? as you know, upon submission there is no auto generated primary key value to be used in other table for joining purpose.

What should I do?

Thanks in advance. :|
The more I learn, The less I know!
User avatar
silvercover
 
Posts: 6
Joined: Thu Jul 30, 2009 8:44 am
   

   

Re: 2 forms and 2 joined tables

Postby jock » Thu Nov 05, 2009 7:00 am

Use the mysql last id function, it will get the primary key of the last inserted record.

http://php.oregonstate.edu/manual/en/pd ... sertid.php
User avatar
jock
Smashing <div>
 
Posts: 178
Joined: Tue Feb 10, 2009 6:03 am
Location: Scotland
   


Return to Server-side Scripting



Who is online

Users browsing this forum: No registered users and 2 guests