Update Multiple Records only updating last record
Looks like Web Assist is dead in the water, No response, no help. Why don't you hire more support help or do something here to answer questions. After joining your monthly subscriptions I feel i have been taken for a ride with the buggy half implemented extensions that are being developed.
Here's the code that your DATAASSIST Update Multi Records produces. It simply does not work at all. How can this issue still go unanswed all this time.
<?php require_once('../Connections/Database.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_Database, $Database);
$query_rsFish = "SELECT TID, NAME, ENABLED FROM TropicalFish WHERE ENABLED = 'Yes' ORDER BY NAME ASC";
$rsFish = mysql_query($query_rsFish, $Database) or die(mysql_error());
$row_rsFish = mysql_fetch_assoc($rsFish);
$totalRows_rsFish = mysql_num_rows($rsFish);?>
<?php
// WA DataAssist Multiple Updates
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
if (!session_id()) session_start();
$WA_loopedIDField = array("WADA_RepeatID_TID");
$WA_connection = $Database;
$WA_table = "TropicalFish";
$WA_redirectURL = "TropicalFish_Results-Enabled.php";
$WA_keepQueryString = false;
$WA_indexField = "TID";
$WA_fieldNamesStr = "NAME|ENABLED";
$WA_columnTypesStr = "',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_Database;
$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("Enabled", $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" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
</head>
<body>
<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_rsFish){
?>
<table width="40%" border="0" cellspacing="0" cellpadding="5">
<tr>
<th>Name</th>
<th>Status</th>
</tr>
<?php do { ?>
<tr>
<td><label>
<input type="hidden" name="WADA_RepeatID_TID_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_TID_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsFish["TID"]; ?>" />
<input name="Name_<?php echo $RepeatSelectionCounter_1; ?>" type="text" id="Name_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsFish['NAME']; ?>">
<input name="ID_<?php echo $RepeatSelectionCounter_1; ?>" type="hidden" id="ID_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsFish['TID']; ?>">
</label></td>
<td><label>
<input name="Enabled_<?php echo $RepeatSelectionCounter_1; ?>" type="text" id="Enabled_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsFish['ENABLED']; ?>">
</label></td>
</tr>
<?php } while ($row_rsFish = mysql_fetch_assoc($rsFish)); ?>
</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_rsFish && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsFish = mysql_fetch_assoc($rsFish);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<p>
<label>
<input type="submit" name="Update" id="Update" value="Submit">
</label>
</p>
</form>
</body>
</html>
<?php
mysql_free_result($rsFish);
?>
I have not touched this code at all so it's fair to say it's not end user error, I would appreciate your attention to this matter ASAP or at least have the courtesy to answer any of my posts or provide a solution to your half baked extension called Data Assist