Forums

This topic is locked

One to many relationship / DreamweaverMX

Posted 30 Jan 2003 11:16:17
1
has voted
30 Jan 2003 11:16:17 Tom Goskar posted:
Does anyone know of an extension (commercial or otherwise) that allows data to be entered on a single page and insert into two tables in a one to many relationship?

An example of what I am trying to do is as follows: I would like for a project to be entered into our site. One project can cover many counties, so on the project form, I would like a subform to enter multiple counties.

There are two tables - tblProjects and tblCounty. The primary key in tblProjects is proj_id, which is the foreign key in tblCounty.

Can anyone help? I'm just beginning to dip into ASP code, but am comfortable with Dreamweaver MX.

Many thanks

Replies

Replied 30 Jan 2003 11:56:11
30 Jan 2003 11:56:11 Julio Taylor replied:
One cool way to do it would be to have users 'add' counties to the main project creation page, vie either a small popup window, (like the smilie one on this page!). Then your could have a onfocus.refresh JS script to refresh the main page once they have finished choosing counties.

You could either store the choices in a temp table, to which you apply a project ID later or something.

But it think the best way would be to create the project first and then have users choose counties. If you manage your data flow nicely, you can make the change between the two pages look seamless and user-friendly.

hope it helps



------------------------
Julio

PHP | MySQL | UD4

ICQ: 19735247
Replied 30 Jan 2003 12:18:19
30 Jan 2003 12:18:19 Tom Goskar replied:
Thanks for the advice. I think that I might have to do it that way.

Adding counties would have to be done one at a time, with the form refreshing each time the submit button is pressed. I could create a list of ones entered so far to remind people what they have put in, I suppose. I like the pop-up idea.

It seems as if inserting data into multiple tables is quite a popular thing to want to do in DWMX. I hope Macromedia look into making this simpler - if only to encourage people to write decent relational databases, instead of the flat file cop-out (which I confess I nearly did in frustration!)...

Back to my thinking cap...

Tom

Reply to this topic