Forum Moderators: coopster

Message Too Old, No Replies

how to populate detail from master

master detail relation

         

randy1as

1:26 am on Nov 6, 2009 (gmt 0)

10+ Year Member



I need to populate the foreign key from master primary key on a php page.
Firstly can I create a page with master data showing on top and detail showing on the same page?

Secondly on editing the detail as new record the primary key populates the detail form without user intervention?

need help

eelixduppy

10:08 pm on Nov 9, 2009 (gmt 0)



Can you please elaborate on what you are trying to do here. Seems a bit unclear to me.

randy1as

1:27 am on Nov 23, 2009 (gmt 0)

10+ Year Member



I am familiar with Access which allows forms and sub forms on a master - detail table linked with one to many relationship.
Was trying to replicate the form in PHP-mysql but failed to do so.

Still need help / script to learn.

coopster

2:24 pm on Dec 5, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I think the question here is how do I set up and populate relational tables with the primary key from the primary table when a new record is added. I'll assume you are using a MySQL database so we are looking for a feature called the LAST_INSERT_ID(). If you are using another RDMS there should be a similar function or method defined to do the same. A search over the forums turns up some good reading on LAST_INSERT_ID [google.com] including this thread on
Getting the id of the last entered record [webmasterworld.com]