close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Multiple edit does not work

Thread began 9/28/2010 5:19 pm by alan_croft399018 | Last modified 10/10/2010 1:59 am by alan_croft399018 | 3396 views | 13 replies

alan_croft399018

Thanks again Dave
We have some action, problem, it updates all fields for all teams with the inputs for team 1, have looked at the table in my c panel and all fields are the same as for team_ID 1. Is it something I have done or is it always this difficult to get a multiple update page to work? I noticed when I created the multiple insert page that some of the code went into the wrong place on the page and was able to fix that myself, maybe I just got lucky? One starts to doubt if "data assist" is a worthwhile investment. I am no expert in php, I would like to be able to write the code myself but do not have that ability. For us dreamweaver users the only option is to buy "extensions" or search the web for tutorials, I sincerely hope we can get this to work as I have built a scoring system that, while it works is cumbersome to use and will require a few of these type of pages to make it easier to use. I am using CS3 does that make a difference?
Really appreciate your assistance

The current code is:

<?php require_once('../Connections/connvbsa.php'); ?>
<?php require_once("../WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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_connvbsa, $connvbsa);
$query_Team_Score_Edit = "SELECT team_id, team_name, team_grade, Result_pos, Result_score, HB FROM Team_entries WHERE Team_entries.team_grade='APB'";
$Team_Score_Edit = mysql_query($query_Team_Score_Edit, $connvbsa) or die(mysql_error());
$row_Team_Score_Edit = mysql_fetch_assoc($Team_Score_Edit);
$totalRows_Team_Score_Edit = mysql_num_rows($Team_Score_Edit);?>
<?php
// WA DataAssist Multiple Updates
if (isset($_POST["button"])) // Trigger
{
if (!session_id()) session_start();
$WA_loopedIDField = array("WADA_RepeatID_team_id");
$WA_connection = $connvbsa;
$WA_table = "Team_entries";
$WA_redirectURL = "Ladders.php";
$WA_keepQueryString = false;
$WA_indexField = "team_id";
$WA_fieldNamesStr = "Result_pos|Result_score|HB";
$WA_columnTypesStr = "none,none,NULL|none,none,NULL|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_connvbsa;
$WA_multipleUpdateCounter = 0;
mysql_select_db($WA_connectionDB, $WA_connection);
while (WA_AB_checkLoopedFieldsNotBlank($WA_loopedIDField, $WA_multipleUpdateCounter)) {
$WA_fieldValuesStr = "".$row_Team_Score_Edit['Result_pos'] ."" . "|" . "".$row_Team_Score_Edit['Result_score'] ."" . "|" . "".$row_Team_Score_Edit['HB'] ."";
$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">
<!-- DW6 -->
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>VBSA Administrative area</title>

<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>


<link href="../CSS/vbsa_DB.css" rel="stylesheet" type="text/css" />


</head>

<body>
<center>

<form id="form1" name="form1" method="post" action="">
<table border="0">
<?php do { ?>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_Team_Score_Edit){
?>
<tr>
<td>Team: <?php echo $row_Team_Score_Edit['team_id']; ?></td>
<td><input type="hidden" name="WADA_RepeatID_team_id_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_team_id_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_Team_Score_Edit["team_id"]; ?>" />
<input type="text" name="Result_pos_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo htmlentities($row_Team_Score_Edit['Result_pos'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
<td><input type="text" name="Result_score_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo htmlentities($row_Team_Score_Edit['Result_score'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
<td><input type="text" name="HB_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo htmlentities($row_Team_Score_Edit['HB'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<?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_Team_Score_Edit && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_Team_Score_Edit = mysql_fetch_assoc($Team_Score_Edit);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
<?php } while ($row_Team_Score_Edit = mysql_fetch_assoc($Team_Score_Edit)); ?>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="Submit" /></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>


</center>

</body>
</html>
<?php
mysql_free_result($Team_Score_Edit);
?>

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