View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

data assist multiple record update

Thread began 10/29/2009 4:02 pm by iain.sutherland290832 | Last modified 10/30/2009 7:23 pm by iain.sutherland290832 | 1353 views | 6 replies

Eric Mittman

Thanks for posting the code, it is helpful. Next time you would like to post with the code of the page it may be better to attach it in a zip archive, this way we can see the line numbers and stuff like that.

In the code you posted I have added some debug statements to the update server behavior. I added a variable that will hold the update sql, then it will print out all of the update statements so we can take a look at them.

Please make a backup of this page and test it with the updated code and let us know what the result is.

Updated Multiple update server behavior:

php:
<?php

// WA DataAssist Multiple Updates
if ($_SERVER["REQUEST_METHOD"] == "POST"// Trigger
{
$the_updates "";
if (!
session_id()) session_start();
$WA_loopedIDField = array("WADA_RepeatID_ItemID");
$WA_connection $mayther;
$WA_table "items";
$WA_redirectURL "admin-change-the-order.php";
$WA_keepQueryString false;
$WA_indexField "ItemID";
$WA_fieldNamesStr "ItemOrder";
$WA_columnTypesStr "none,none,NULL";
$WA_fieldNames explode("|"$WA_fieldNamesStr);
$WA_columns explode("|"$WA_columnTypesStr);
$WA_connectionDB $database_mayther;
$WA_multipleUpdateCounter 0;
mysql_select_db($WA_connectionDB$WA_connection);
while (
WA_AB_checkLoopedFieldsNotBlank($WA_loopedIDField $WA_multipleUpdateCounter)) {
$WA_fieldValuesStr "".WA_AB_getLoopedFieldValue("ItemOrderChange" $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 "";
$the_updates .= "<br/>" $WA_Sql;
$MM_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
$WA_multipleUpdateCounter++;
}
die(
$the_updates);
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);
}
}
?>

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