close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to add/subtract the two insert query columns into a third insert query column

Thread began 3/08/2023 5:27 am by Jared Lui | Last modified 3/09/2023 10:59 am by Ray Borduin | 227 views | 1 replies |

Jared Lui

How to add/subtract the two insert query columns into a third insert query column

Hi Ray,

I have 2 related questions:

First.
This is from my PayPal listener.php page. For some reason PayPal sends the mc_gross and mc_fee data to the listener page but not the "net" value which I'd like to save in the DB so I don;t have to do that extra math in recordsets, etc. later.

I'm wanting to subtract the mc_fee from the mc_gross and insert it into the netPayment column.

Here's a couple that don't work.

$InsertQuery->bindColumn("duesAmtPaid", "d", "".$_POST["mc_gross"]  ."", "WA_DEFAULT");
$InsertQuery->bindColumn("payPalFee", "d", "".$_POST["mc_fee"] ."", "WA_DEFAULT");
$InsertQuery->bindColumn("netPayment", "d", "".$_POST["mc_gross - mc_fee"] ."", "WA_DEFAULT");
$InsertQuery->bindColumn("duesAmtPaid", "d", "".$_POST["mc_gross"]  ."", "WA_DEFAULT");
$InsertQuery->bindColumn("payPalFee", "d", "".$_POST["mc_fee"] ."", "WA_DEFAULT");
$InsertQuery->bindColumn("netPayment", "d", "".$_POST["mc_gross"] - ["mc_fee"] ."", "WA_DEFAULT");



I solved the second one
$UpdateQuery->bindColumn("user_id", "i", "".($_SESSION['UserID']) ."", "-1");
$UpdateQuery->bindColumn("id", "i", "".($_SESSION['UserID']) ."", "-1");


Second.
In a different (update) page for a users table, I need to be able to copy the auto-incremented userID that held in the session when the users is logged in and upon updating, save that id into a new column in the same table. (I have a members area with a users table, I have a third party chat system and third party blog system and want them all to use the same users table. However, each has their own login system and of course DB structures, I have everything working except I have to manually copy over the userID from the original users table userID column into the other new columns for the third party apps (userid and user_id).

Here's how I dealt with the users first and last names (on the update page - this is the same for the insert page).

$UpdateQuery->bindColumn("UserFirstName", "s", "".((isset($_POST["UserFirstName"]))?$_POST["UserFirstName"]:"")  ."", "WA_BLANK");
$UpdateQuery->bindColumn("fname", "s", "".((isset($_POST["UserFirstName"]))?$_POST["UserFirstName"]:"") ."", "WA_BLANK"); /*?>chat system<?php */
$UpdateQuery->bindColumn("firstname", "s", "".((isset($_POST["UserFirstName"]))?$_POST["UserFirstName"]:"") ."", "WA_BLANK"); /*?>post system<?php */
$UpdateQuery->bindColumn("UserLastName", "s", "".((isset($_POST["UserLastName"]))?$_POST["UserLastName"]:"") ."", "WA_BLANK");
$UpdateQuery->bindColumn("lname", "s", "".((isset($_POST["UserLastName"]))?$_POST["UserLastName"]:"") ."", "WA_BLANK"); /*?>chat system<?php */
$UpdateQuery->bindColumn("lastname", "s", "".((isset($_POST["UserLastName"]))?$_POST["UserLastName"]:"") ."", "WA_BLANK"); /*?>post system<?php */


I've tried to use variations from the users update recordset and the session but nothing works or shows errors.
For example: $UpdateQuery->bindColumn("user_id", "=", "d", "".((isset($_SESSION['UserID']))?$_SESSION['UserID']:"") ."");

$WADAusers_update->bindParam("i", "".($_GET['UserID'])  ."", "-1"); //ParamUserID
$rsUser->bindParam("i", "".($_SESSION['UserID']) ."", "-1"); //colname



I am sure that both of these are doable but I am not understanding the format.

Thanks
Jared

Sign in to reply to this post

Ray BorduinWebAssist

Please post multiple questions in multiple threads. They are too hard to follow otherwise.

I think the first one is:

$InsertQuery->bindColumn("netPayment", "d", "". (floatval($_POST["mc_gross"]) - floatval($_POST["mc_fee"])) ."", "WA_DEFAULT");

Sign in to reply to this post
Did this help? Tips are appreciated...

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