Page 1 of 1

Long query ..HELP???

Posted: Thu Jul 29, 2004 8:34 pm
by jamesloi
hello..

I am getting the values $accountFrom , $accountTo and $amount
and i wish to use these in a query...

I am trying to update both accounts by the amount that is set by the user using a SINGLE query.. does anyone know if this can be done?

e.g. sorry for the bad SQL code

UPDATE G_ML_Account WHERE Account_Num='$accountFrom' SET MLM_Balance= MLM_Balance - '$amount'

UPDATE G_ML_Account WHERE Account_Num='$accountTo' SET MLM_Balance= MLM_Balance + '$amount'

Anyone know how i can combine these queries into 1 ?? 8)

Posted: Wed Aug 25, 2004 7:14 am
by Lord Sauron

Code: Select all

<?php

IF (.......) {
    $MLM_Balance= $MLM_Balance - $amount;
}
ELSE {
    $MLM_Balance= $MLM_Balance + $amount;
}  

$this->MLM_Balance = $MLM_Balance;
$result = performQuery("UPDATE MLM_Balance_Table SET MLM_Balance = ".$this->MLM_Balance.";", "Database cannot perform query");

?>