View Full Version : Insert multiple record in two tables
info321189
06-24-2009, 11:41 AM
Hi, I need to create an image gallery, the first table contain the gallery name, date created and the thumb pic, the second table contain the picture, the name and description.
I add the gallery ID field in the pics table.
I need to build a insert page with gallery name, date created and multiple insert record for pics.
I already try to do this with manage relational table but I get the error :" Column 'IDgallery' cannot be null ".
Before using DataAssist I do this by creating a page for assign the IDgallery and another page to update the table in relation.... :-s
Ray Borduin
06-24-2009, 12:32 PM
You should do it the same way now... two separate pages.
info321189
06-24-2009, 04:15 PM
Hello Ray, thankyou for the fast reply, I can use manage relational table if I not insert multiple records in the details relation ?
I see a lot of gallery with mootools-slide like effect, all galleries require the galleryname ( and set with this the galleryID I think ) at the end of setup, after load on the server all pics and descriptions... the only way to do this is passing a lot of session variables ?
I can do this with WADA insert multiple records server behaviors ?
Thankyou again.
Ray Borduin
06-25-2009, 07:48 AM
I would need to really understand your database and form design to be sure what is or isn't possible with each tool.
Multiple Insert will do an insert statement for multiple rows as displayed using the "repeat selection" server behavior
Multiple Updeate will execute an update for multiple rows displayed with a "repeat selection" server behavior from dataassist.
Manage relational table will delete records based on a key (ParentID) and insert multiple records based on a multiselect list or group of radio buttons. The effect is similar to an update but is actually achieved through a delete and insert. This is good for managing related tables in a three table database structure when fields from the first child already exist and you are inserting or updating the parent record.
Depending on your workflow, database structure, and what pages you use for what functionality it could be done a number of ways.
info321189
06-25-2009, 02:37 PM
Hello Ray, this is a picture that show the relation in my database, I use MySQL database (MyISAM).
http://img524.imageshack.us/img524/5315/relation.th.jpg (http://img524.imageshack.us/i/relation.jpg/)
My goal is an insert page with multiple images fields and gallery name.
I see some dynamic galleries on the web that do this.
The right way is create an insert record link and point to a page for create the IDgallery and a default gallery_name and redirect to another page with update record ?
Thankyou for your patience
Ray Borduin
06-26-2009, 05:58 AM
Since there are only tow tables you wouldn't use manage relational table.
You could probably use the Insert server behavior on multiple pages, or really run DataAssist two times and link the groups of pages for full management of a two table relationship.
An example is what you see in the powerstore order information. It uses the orders and orderdetails tables and provides back-end read access and order update. You could imagine a similar implementation with edit access to the individual child records as well in that framework.
The reality is that it takes several pages to allow someone to find, insert, update records from both tables. You can do it all with just single inserts at a time, you just want to maintain a relationship but that doesn't necessarily mean even using multiple insert although you could design a user interface to do that.
Your database design is too simple to take advantage of manage relational tables, so you can ignore that. From there what you use depends on what user interface you decide you want.
info321189
06-26-2009, 09:44 AM
Hello Ray and thankyou again for your patience.
I can found any sample or tutorial how can work the 'manage relational table' server behavior ?
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.