I'm using the open source broker Ganimede and it's PHP API to build an e-commerce website. I'm working on the shopping cart functions right now.
I have a function that is supposed to update the quantity of item's in the cart by calling the gnm_update() function. I want to add the new quantity ammount to the old quantity in the db instead of simply replacing it.
Right now, I am doing this using two queries: one to fetch the old qty and store it into a php variable, and the second to add the old qty to the new qty and insert it into the cart row. Here's that bit of code:
This works, but I would rather use just one query to be more efficient. I've tried several methods shown in the SQL92 manual but gnm_update() doesn't seem to be capable of handling any of these SQL expressions in the fields array.
Thanks in advance to any suggestions.
-Avram
I have a function that is supposed to update the quantity of item's in the cart by calling the gnm_update() function. I want to add the new quantity ammount to the old quantity in the db instead of simply replacing it.
Right now, I am doing this using two queries: one to fetch the old qty and store it into a php variable, and the second to add the old qty to the new qty and insert it into the cart row. Here's that bit of code:
PHP:
$qTableArray["soTempDocLn"] = "CustNum = '{$vCustNum}' AND UserCode = '{$vUserCode}' AND ItemNum = '{$vItemNum}' ";
//get_orderQty() returns the existing quantity of the order and $vQty is the new quantity that the customer wants to add to the order
$qFields["OrderQty"] = get_orderQty($_SESSION["vLnSeq"]) + $vQty;
return gnm_update($qTableArray, $qFields) or die("couldn't update cart, ".gnm_error());
Thanks in advance to any suggestions.
-Avram