Multiple record update not working
Trying a simple test prior to trying to use on website.
Very basic update multiple attempt not working at all.
Appreciate your analysis.
Page Code follows:
<?php require_once('Connections/cingular.php'); ?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_cingular, $cingular);
$query_rs_move = "SELECT * FROM items2 ORDER BY OrderBy ASC";
$rs_move = mysql_query($query_rs_move, $cingular) or die(mysql_error());
$row_rs_move = mysql_fetch_assoc($rs_move);
$totalRows_rs_move = mysql_num_rows($rs_move);?>
<?php
// WA DataAssist Multiple Updates
if (isset($_POST["submit"])) // Trigger
{
if (!session_id()) session_start();
$WA_loopedIDField = array("WADA_RepeatID_ItemID");
$WA_connection = $cingular;
$WA_table = "items2";
$WA_redirectURL = "move.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "ItemID";
$WA_fieldNamesStr = "ItemName|itemDiam|ItemSKU|OrderBy";
$WA_columnTypesStr = "',none,''|none,none,NULL|',none,''|none,none,NULL";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_cingular;
$WA_multipleUpdateCounter = 0;
mysql_select_db($WA_connectionDB, $WA_connection);
while (WA_AB_checkLoopedFieldsNotBlank($WA_loopedIDField, $WA_multipleUpdateCounter)) {
$WA_fieldValuesStr = "".WA_AB_getLoopedFieldValue("name", $WA_multipleUpdateCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("diam", $WA_multipleUpdateCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("SKU", $WA_multipleUpdateCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("sortorder", $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 XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="" enctype="multipart/form-data" name="form1">
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rs_move){
?>
<table border="1">
<tr>
<td>ItemID</td>
<td>ItemName</td>
<td>itemDiam</td>
<td>ItemSKU</td>
<td>OrderBy</td>
</tr>
<?php do { ?>
<tr>
<td><input type="hidden" name="WADA_RepeatID_ItemID_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_ItemID_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rs_move["ItemID"]; ?>" />
<input name="ID_<?php echo $RepeatSelectionCounter_1; ?>" type="text" value="<?php echo $row_rs_move['ItemID']; ?>"/></td>
<td><input name="name_<?php echo $RepeatSelectionCounter_1; ?>" type="text" value="<?php echo $row_rs_move['ItemName']; ?>" /></td>
<td><input name="diam_<?php echo $RepeatSelectionCounter_1; ?>" type="text" value="<?php echo $row_rs_move['itemDiam']; ?>" /></td>
<td><input name="SKU_<?php echo $RepeatSelectionCounter_1; ?>" type="text" value="<?php echo $row_rs_move['ItemSKU']; ?>" /></td>
<td><input name="sortorder_<?php echo $RepeatSelectionCounter_1; ?>" type="text" value="<?php echo $row_rs_move['OrderBy']; ?>" /></td>
</tr>
<?php } while ($row_rs_move = mysql_fetch_assoc($rs_move)); ?>
</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_move && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rs_move = mysql_fetch_assoc($rs_move);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<input name="submit" type="submit" value="submit" />
</form>
</body>
</html>
<?php
mysql_free_result($rs_move);
?>