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