close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DataAssist Multiple Record Update not updating records

Thread began 3/22/2010 11:21 am by kevin347925 | Last modified 3/23/2010 1:52 pm by Jason Byrnes | 1505 views | 9 replies |

kevin347925

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>&nbsp;</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

Sign in to reply to this post

Jason ByrnesWebAssist

try changing the following line of code:

php:
<?php } while ($row_rs_slideshow mysql_fetch_assoc($rs_slideshow)); ?>





to:

php:
<?php $RepeatSelectionCounter_1++; ?><?php } while ($row_rs_slideshow mysql_fetch_assoc($rs_slideshow)); ?>
Sign in to reply to this post

kevin347925

No luck.

Hi Jason,

Thanks for the help.

I tried the line of code you gave me, and I didn't have any luck. The unchanged data displays in the fields after I hit submit.

Sign in to reply to this post

Jason ByrnesWebAssist

If you reload the page does the changed data display?


It may be that the rs_slideshow recordset is on the page before the update behavior. if this is the case, the recordset is created before the data in the database is updated. This will cause the recordset to be created with the old data. you may have to manually move the recordset code so that it is after the update behavior.

Sign in to reply to this post

kevin347925

still no luck

Jason,

The data does not change after reloading the page.

I moved the recordset and still no luck. The data does not change after I submit the page.

Sign in to reply to this post

Jason ByrnesWebAssist

please send a copy of the actual php page in a zip archive so I can see the code in context.

Sign in to reply to this post

kevin347925

Sure thing.

Attached Files
MANAGEslideshow.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

The submit button is part of the repeat selection, so its name has been changed to be dynamic.

change:
<input class="button" style="font-family:Arial;" type="submit" name="updateshow_<?php echo $RepeatSelectionCounter_1; ?>" id="updateshow_<?php echo $RepeatSelectionCounter_1; ?>" value="Update Slides">



to:
<input class="button" style="font-family:Arial;" type="submit" name="updateshow" id="updateshow" value="Update Slides">

Sign in to reply to this post

kevin347925

After making the change you requested, I submitted the form. However, it actually cleared the database column that I had tried to change.

In short, when I hit submit, rather than updating the column of fields, it erased all the data in a column.

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket for you so we can look into this in more depth.

to view and edit your support ticket, please visit your support history:
forums/

Sign in to reply to this post
loading

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