close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

How can I get Multiple Insert, Update, Delete with MRT all working together??

Thread began 5/12/2010 1:44 pm by troyd | Last modified 5/17/2010 5:08 pm by troyd | 2938 views | 9 replies

troyd

Originally Said By: Jaffa
  Add a second Delete server behaviour within your form server behaviours using the same trigger as the first delete.

Delete from relationship table where [ID] = SubCatID  



Thanks so much Jaffa,

I have tried doing this, but to be honest, I'm not grasping it within the code. The second multiple delete behavior is pasted below. I assume that I need to hand code the WHERE clause towards the bottom. But everything I try, fails.

A side note, my repeat selection uses a recordset that references only the Sub Categories table. Is there anything I need to add to the repeat selection to loop through the relational table? Or should I be using a JOIN recordset including both the SubCategory and relational table together for this repeat region/selection?

php:
<?php

// WA DataAssist Multiple Deletes
if (isset($_POST["UpdateSubCatBtn_x"])) // Trigger
{
  if (!
session_id()) session_start();
  
$WA_loopedIDField = array("WADA_RepeatID_TableID");
  
$WA_loopedField = array("DelSubCatchecked");
  
$WA_connection $dbStore;
  
$WA_table "relCat_SubCat";
  
$WA_redirectURL "products_Categories.php";
  
$WA_keepQueryString false;
  
$WA_indexField "TableID";
  
$WA_columnTypesStr "none,none,NULL";
  
$WA_fieldNames explode("|"$WA_indexField);
  
$WA_columns explode("|"$WA_columnTypesStr);
  
$WA_comparisions = array("=");
  
$WA_connectionDB $database_dbStore;
  
$WA_multipleDeleteCounter 0;
  
mysql_select_db($WA_connectionDB$WA_connection);
  while (
WA_AB_checkLoopedFieldsNotBlank($WA_loopedIDField$WA_multipleDeleteCounter)) {
    if (
WA_AB_getLoopedFieldValue($WA_loopedIDField[0], $WA_multipleDeleteCounter) == WA_AB_getLoopedFieldValue($WA_loopedField[0], $WA_multipleDeleteCounter)) {
      
$WA_fieldValuesStr WA_AB_getLoopedFieldValue($WA_loopedIDField[0], $WA_multipleDeleteCounter);
      
$WA_fieldValues = array($WA_fieldValuesStr);
      
$deleteParamsObj WA_AB_generateWhereClause($WA_fieldNames$WA_columns$WA_fieldValues$WA_comparisions);
      
$WA_Sql "DELETE FROM `" $WA_table "` WHERE " $deleteParamsObj->sqlWhereClause;
      
$MM_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
    }
    
$WA_multipleDeleteCounter++;
  }
  if (
$WA_redirectURL != "")  {
    if (
$WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      
$WA_redirectURL .= ((strpos($WA_redirectURL'?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    
header("Location: ".$WA_redirectURL);
  }
}
?>



Lastly, on this delete behavior, do I use the TableID or the Parent_SubCategoryID for the index field? $WA_indexField = "TableID";
In this table, as you can see, the TableID is the unique column.

Thanks again,
TroyD

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