close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Inserting to Tables

Thread began 11/16/2009 11:59 am by rog4679 | Last modified 11/19/2009 8:06 pm by Eric Mittman | 1411 views | 6 replies |


Inserting to Tables

I've been reading the relational table threads and understand the Primary and Foreign key relationships, but not the sequence to create the pages

I would like visitors (who are logged in) to create a post in the blogs table.

There are three tables:
VisitorsID PK

BlogVisitorsID FK

BlogItemsID PK
BlogItemsBlgID FK (BlogID PK)
BlogItemsVisitorsID FK (VisitorsID PK)

The insert page to post a blog will have one user with many blogs. The fields are:
Username (from the Visitors Table)
Subject (inserts into the Blogs Table)
Message(inserts into the Blogs Table)

I need to know how to create the insert page above. How do I populate the Username Field from the Visitors table? How do I post all three fields for that session into the Blogs table?

Their post appears as a repeating table:

User Name Subject Posted (date timestamp field)
Fred Christmas Party 12/21/09
Susan Does anyone have a receipe? 11/14/09

If you click on the subject you're taken to the detail page:
Fred posted on 12/21/09
Christmas Party
You can RSVP to attend before 12/15...................

Sign in to reply to this post

Eric Mittman

The structure you are working with seems to relate well here. You would have to start with a users table that had at least one record, this user would then need to have a record in the blogs table with their user id. Once you have the tables with at least one record for these you can insert into the blog items table the current blog entry from the user.

This page should just be inserting into your blog entries table after the user logs in and selects the blog or has the blog set automatically based on their id.

If you would like the page to be doing more than the single insert you can just add to it with more insert server behaviors. I think it would be best for you to get the page working with the main insert on it first though. Please post back with any additional questions you have about any part of this.

Sign in to reply to this post


Tables Relation

This post has been deleted.


Data Assist Wizzard

I have run the Data Assist Wizzard using the connection table - blogItems.

On the insert page, the session variable for blogItems is an WADA insert field. The value is blogItems ID.

Now the blog items insert page has its own Primary Key(blogItems). And, two empty Foreign Keys (visitorsID and blogsID).

Is this the correct session variable? And, how do I relate the fields from the visitors and blogs tables? Could I add a recordset?

I've subscribed to and have found this to be a good source for answers, but the relations in the tutorials are slightly different than the dataAssist forms.

Maybe I need to know where to apply the session/behaviors after the DA wizzard creates the pages? Thanks for your help - rog

Sign in to reply to this post

Eric Mittman

I think you are off to a correct start. To relate the insert on this page with the foreign keys for the userid and blogid you will need to have access to those id's. Since the blog should be associated with the user if you had the user id you should be able to create a recordset and query the blog table for the id.

You would normally have a user login set of pages. If you use Security Assist to create this set of pages you should have the user id stored in a session variable after the user logs in. You would then use this userID session variable to filter your recordset to get the blog id or id's for that user. Once you have the values you need from the recordset you can store the blog id in a session variable and make reference to this session variable for the insert of the blog entry.

Do you have a user login section setup on the site yet? If not I think this would be the next step. Also do you have an insert page for the blog itself?

Sign in to reply to this post


Hello Eric,

I apologize for jumping in on this thread, it's that it seems to be in the same channel a an issue I'm having that has been posted on this thread. I received an answer to the original topic but not the follow up topic.

Any help would be great.


(or reprimand and deletion for butting in here);)

Sign in to reply to this post


Session Variable

Hi Eric -

I'm following your instructions and there are three things happening.

1-The insert page isn't filtering by a session variable.
2-The insert page inserts all form values except user ID (FK).
3-The insert page doesn't inert a new Blog ID into the Blogs table.

I do have login pages with a session variable - VisitorID.

I created a rsBlogs - filtering by the login session variable, Visitor ID.

Then using the new rsBlogs, I created a new session variable (Blogs ID).

The Blogs ID is used for the session variable in the insert record behavior.

On the insert page, my update server behavior does not have a value to post the FKs. (I'm assuming that's alright).

Could you please help me here. I've tried several combinations.

Attached Files
Sign in to reply to this post

Eric Mittman

In the insert page for the blog items this is the list of fields you are inserting into:


In here I do not see either of your foreign keys listed for the userID or the blogID. According to your earlier posts you should have these two fields also:

BlogItemsBlgID FK (BlogID PK)
BlogItemsVisitorsID FK (VisitorsID PK)

You will need to ensure that you have these columns specified in your insert server behavior. For the values of these fields you should be using the session user id and your recordset value for the blog id like this:

BlogItemsBlgID FK = $row_rsBlogs['BlogID']
BlogItemsVisitorsID FK = $_SESSION['VisitorID']

Give this a try and update the insert server behavior to insert these values into the columns. If your table structure has changed or is different from what is listed here let me know about the differences and I can help you get things adjusted.

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





Ease of use


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...