chestertb
11-06-2005, 07:04 AM
Hi All,
I have a browser based point of sale system that updates stock levels as each sale is processed. When the sale is processed the php script adjusts the stock level something like this...
$qru = "UPDATE items SET ITinstore = ITinstore - $iqty WHERE ITrn = '$irn'";
$rsu = mysql_query($qru, $link);
where $iqty is the quantity sold and $irn is the item record number.
However, some products, like Membership, are virtual products that have no stock level. These are flagged in the item file by ITtype = "V".
I want to make the above query conditional so that it does NOT perform the update if ITtype="V". I could fetch each item, check ITtype and then update or not according to the value, but that means reading the record before I update it. Is there an SQL shortcut that allows me to perform the query ONLY when ITtype != "V" ?
Thanks
CTB
I have a browser based point of sale system that updates stock levels as each sale is processed. When the sale is processed the php script adjusts the stock level something like this...
$qru = "UPDATE items SET ITinstore = ITinstore - $iqty WHERE ITrn = '$irn'";
$rsu = mysql_query($qru, $link);
where $iqty is the quantity sold and $irn is the item record number.
However, some products, like Membership, are virtual products that have no stock level. These are flagged in the item file by ITtype = "V".
I want to make the above query conditional so that it does NOT perform the update if ITtype="V". I could fetch each item, check ITtype and then update or not according to the value, but that means reading the record before I update it. Is there an SQL shortcut that allows me to perform the query ONLY when ITtype != "V" ?
Thanks
CTB