DataAssist Multiple Record Update not updating records
Hello,
I have spent a lot of time trying to get the multiple record update behavior to work, and I have not been successful. From other forum posts, I know that there is a bug, but I am unable to fix it in my code. Is the DataAssist version update coming soon? The code is pasted below. Help would be very much appreciated.
<?php
// WA DataAssist Multiple Updates
if (isset($_POST["updateshow"])) // Trigger
{
if (!session_id()) session_start();
$WA_loopedIDField = array("WADA_RepeatID_DataID");
$WA_connection = $conn_dynamic;
$WA_table = "DynamicData";
$WA_redirectURL = "MANAGEslideshow.php";
$WA_keepQueryString = false;
$WA_indexField = "DataID";
$WA_fieldNamesStr = "MakeSlide|SlideTitle|HideSlide|ButtonLabel|ButtonOrder";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_conn_dynamic;
$WA_multipleUpdateCounter = 0;
mysql_select_db($WA_connectionDB, $WA_connection);
while (WA_AB_checkLoopedFieldsNotBlank($WA_loopedIDField, $WA_multipleUpdateCounter)) {
$WA_fieldValuesStr = "".WA_AB_getLoopedFieldValue("removeslide", $WA_multipleUpdateCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("slidetitle", $WA_multipleUpdateCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("showslide", $WA_multipleUpdateCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("buttontitle", $WA_multipleUpdateCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("slideorder", $WA_multipleUpdateCounter) ."";
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_where_fieldValuesStr = WA_AB_getLoopedFieldValue($WA_loopedIDField[0], $WA_multipleUpdateCounter);
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$WA_multipleUpdateCounter++;
}
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);
}
}
?><?php
// RepeatSelectionCounter_1 Initialization
$RepeatSelectionCounter_1 = 0;
$RepeatSelectionCounterBasedLooping_1 = false;
$RepeatSelectionCounter_1_Iterations = "1";
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
<html>........
......
<form name="form1" method="post" action="">
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rs_slideshow){
?>
<table class="tableinfo" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>Slide Order:</th>
<th>Slide Title:</th>
<th>Button Title:</th>
<th>Category<br />(optional):</th>
<th> </th>
<th>Show<br />Slide:</th>
<th>Remove<br />Slide:</th>
</tr>
<?php do { ?>
<tr>
<td style="border-left:#46290D 1px dotted; width:50px;"><label><input type="hidden" name="WADA_RepeatID_DataID_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_DataID_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rs_slideshow["DataID"]; ?>" />
<input class="slideinput" type="text" name="slideorder_<?php echo $RepeatSelectionCounter_1; ?>" id="slideorder_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rs_slideshow['ButtonOrder']; ?>"></label></td>
<td><label><input class="slideinput" type="text" name="slidetitle_<?php echo $RepeatSelectionCounter_1; ?>" id="slidetitle_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rs_slideshow['SlideTitle']; ?>"></label></td>
<td><label><input class="slideinput" type="text" name="buttontitle_<?php echo $RepeatSelectionCounter_1; ?>" id="buttontitle_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rs_slideshow['ButtonLabel']; ?>"></label></td>
<td style="vertical-align:middle; text-align:center; width:50px;"><a href="DYNAMICresults.php?cat=<?php echo $row_rs_slideshow['Category']; ?>" target="_blank"><?php echo $row_rs_slideshow['Category']; ?></a></td><td style="padding:10px;"><label><a href="DYNAMICdetail.php?DataID=<?php echo $row_rs_slideshow['DataID']; ?>">edit</a></label></td>
<td><input <?php if (!(strcmp($row_rs_slideshow['HideSlide'],"show"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="showslide_<?php echo $RepeatSelectionCounter_1; ?>" id="showslide_<?php echo $RepeatSelectionCounter_1; ?>" value="show"></td>
<td><label><input type="checkbox" name="removeslide_<?php echo $RepeatSelectionCounter_1; ?>" id="removeslide_<?php echo $RepeatSelectionCounter_1; ?>" value=""></label></td>
</tr>
<?php } while ($row_rs_slideshow = mysql_fetch_assoc($rs_slideshow)); ?>
<tr>
<td style="border-left:#46290D 1px dotted; padding:20px 50px;" colspan="7">
<div align="center">
<input class="button" style="font-family:Arial;" type="submit" name="updateshow_<?php echo $RepeatSelectionCounter_1; ?>" id="updateshow_<?php echo $RepeatSelectionCounter_1; ?>" value="Update Slides">
</div></td>
</tr>
</table>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<td>No records match your request.</td>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rs_slideshow && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rs_slideshow = mysql_fetch_assoc($rs_slideshow);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</form>
Thank you in advance.
Peace,
Kevin