close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Using SUM on Update

Thread began 5/04/2021 11:11 am by dhagood355349 | Last modified 5/05/2021 8:45 am by dhagood355349 | 16 views | 4 replies

dhagood355349

Using SUM on Update

I'm sure this is covered somewhere in the forum. I want to take the sum of two values from two columns (SQL) from 1 id and update another column on Update from a webassist update page.

The two values would be the SUM of Day1_TotalWeight and Day2_TotalWeight to update Final_Weight

Thanks in advance!!!

<?php
$WADAAFTDirResult_update = new WA_MySQLi_RS("WADAAFTDirResult_update",$XXXXX,1);
$WADAAFTDirResult_update->setQuery("SELECT id, EventID, DQ, FullName, MemberID, Day2_Fish, Day2_Alive, Day2_Short, Day2_Penalty, Day2_BigBass, Day2_ScaleWeight, Day1_TotalWeight, Day2_TotalWeight, Points, Payout, Payout_Description FROM AFTDirResult WHERE AFTDirResult.id = ?");
$WADAAFTDirResult_update->bindParam("i", "".($_GET['id']) ."", "-1"); //Paramid
$WADAAFTDirResult_update->execute();
?>
<?php
if (isset($_POST["Update"]) || isset($_POST["Update_x"])) {
$UpdateQuery = new WA_MySQLi_Query($XXXXX);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "AFTDirResult";
$UpdateQuery->bindColumn("DQ", "s", "".((isset($_POST["DQ"]))?$_POST["DQ"]:"") ."", "WA_BLANK");
$UpdateQuery->bindColumn("Day2_Fish", "d", "".((isset($_POST["Day2_Fish"]))?$_POST["Day2_Fish"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Day2_Alive", "d", "".((isset($_POST["Day2_Alive"]))?$_POST["Day2_Alive"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Day2_Short", "d", "".((isset($_POST["Day2_Short"]))?$_POST["Day2_Short"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Day2_Penalty", "d", "".((isset($_POST["Day2_Penalty"]))?$_POST["Day2_Penalty"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Day2_BigBass", "d", "".((isset($_POST["Day2_BigBass"]))?$_POST["Day2_BigBass"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Day2_ScaleWeight", "d", "".((isset($_POST["Day2_ScaleWeight"]))?$_POST["Day2_ScaleWeight"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Day2_TotalWeight", "d", "".((isset($_POST["Day2_TotalWeight"]))?$_POST["Day2_TotalWeight"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Points", "d", "".((isset($_POST["Points"]))?$_POST["Points"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Payout", "d", "".((isset($_POST["Payout"]))?$_POST["Payout"]:"") ."", "WA_ZERO");
$UpdateQuery->bindColumn("Payout_Description", "s", "".((isset($_POST["Payout_Description"]))?$_POST["Payout_Description"]:"") ."", "WA_BLANK");
$UpdateQuery->addFilter("id", "=", "d", "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."");
$UpdateQuery->execute();
$UpdateGoTo = "ResultD2_detail.php?id=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."".(isset($_GET["pageNum_WADAAFTDirResult"])?"&pageNum_WADAAFTDirResult=".intval($_GET["pageNum_WADAAFTDirResult"]):"") ."";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>

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