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

Manage Relational Tables on Update Page

Thread began 6/26/2009 5:38 pm by webdev777 | Last modified 6/26/2009 5:38 pm by webdev777 | 935 views | 0 replies


Manage Relational Tables on Update Page


I have a many-to-many relationship between products and categories on an ecommerce site. The relational table, relprodcat contains only the foreign keys ProductID and CategoryID. I have succeeded in using the MRT server behavior to populate the relational table properly from the Product Insert page. Now I'm wrestling with the update page.

I assumed that the MRT can and should be used on the update page as well. The thing I'm having trouble figuring out is how to modify that code to have the update page's multiple select list for category, managed via the MRT relational table, generate the appropriate "selected" attribute as derived from the related records. The code for that list is below:

do {

<option value="<?php echo $row_ProductCategoryList['CategoryID']?>"<?php if (!(strcmp($row_ProductCategoryList['CategoryID'], (isset($_GET['valid'])?ValidatedField("ProductsUpdate","ProductCategoryID"):$row_WADAProducts['ProductCategoryID'])))) {echo "selected=\"selected\"";} ?>

<?php if (!(strcmp($row_ProductCategoryList['CategoryID'], WA_AB_returnPreSelectValue($WA_PreSelect_RelationalTable_1, $row_ProductCategoryList['CategoryID'])))) {echo "selected=\"selected\"";} ?> ><?php echo $row_ProductCategoryList['CategoryName']?></option>

} while ($row_ProductCategoryList = mysql_fetch_assoc($ProductCategoryList));
$rows = mysql_num_rows($ProductCategoryList);
if($rows > 0) {
mysql_data_seek($ProductCategoryList, 0);
$row_ProductCategoryList = mysql_fetch_assoc($ProductCategoryList);

The problem lies in that the multiple select list must have categories selected on the first run of the page, before the data is changed and run a second time via "post". Therefore the string compareson for
WA_AB_returnPreSelectValue($WA_PreSelect_RelationalTable_1, $row_ProductCategoryList['CategoryID'])
fails as it is not populated until the "post", nor are the validation fields.

In addition, even if I highlight new categories, no changes are made in the relational table. So I can't help thinking that I missing something in the use of this behavior for anything but an insert page. Am I headed down the right path? Am I getting confused on the proper use of this behavior?

A thorough tutorial on using the MRT in many situations would certainly save a ton of confusion. The help file alone is not enough.



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