close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

1 Form, 3 fields into diffrent tables

Thread began 9/09/2009 1:50 pm by meister281653 | Last modified 9/10/2009 1:54 pm by Jimmy Wu | 1320 views | 7 replies |

meister281653

1 Form, 3 fields into diffrent tables

Hi,

I got a form with 3 fields. For example, Province, City, Postcode. I want every field be stored in a diffrent table. does that work with DA?

Could it be that? Manage Relational Table!

Cheers,
Denis

Sign in to reply to this post

Jimmy Wu

For each of the tables you will use the Single Record Insert server behavior once. You can apply it 3 different times for the three different tables on the different fields being inserted.

So for your example, you would set up a Single Record Insert server behavior for Province, and then one for City and one for Postcode and they'd each be set up to insert into different tables.

Sign in to reply to this post

John LangerBeta Tester

A further question on this subject.

Originally Said By: Jimmy Wu
  For each of the tables you will use the Single Record Insert server behavior once. You can apply it 3 different times for the three different tables on the different fields being inserted.

So for your example, you would set up a Single Record Insert server behavior for Province, and then one for City and one for Postcode and they'd each be set up to insert into different tables.  



Hi Jimmy (or anyone who can help),

As my query is similar I thought I'd tag onto this thread. Hope that's OK?

So, in my case I'm inserting into two tables from the one form

The second table is all from hidden fields. I have no problem with that. The problem is that one field within the second table is to insert the first tables ID number which is being made automatically with the auto-increment. I want that inserted into table two as a foreign key

Table 1 = tableID
Table 2 = FKtableID

Is that possible?

Many thanks.

Sign in to reply to this post

meister281653

so let me see if i understand what you want.

you insert into one table.

and want to insert the created ID into to next table as foreign key?

then use

mysql_insert_id()

for example.

between the 2 DA code blocks place:

<?php
$foreignKey = mysql_insert_id();
?>



then you can store the $foreignKey into the next DA code block

denis

Sign in to reply to this post

John LangerBeta Tester

Hi Denis,

That may just be explained a little simplisticly for me. If you assume I don't know much about PHP you'd be right. :)

I think I'm with you though so let me have a go and I'll get back to you.

Many thanks for your help.

Sign in to reply to this post

John LangerBeta Tester

Well Denis,

You are a genius :)

That worked a treat.

Many, many thanks.

P.S. I have to do the "update" now, having cracked the "insert". I'll let you know how I get on :)

Sign in to reply to this post

John LangerBeta Tester

Well, that was a breeze.

All because I don't have to update the second table. The "insert" to the second table is all hidden fields or session values. Once inserted they stay the same. Any updates only happen to the first table so no worries there.

Thanks once again for your help Denis.

Sign in to reply to this post

Jimmy Wu

Thanks Denis for help on John's issue.

John: I'm glad you got that all sorted out.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...