Continue Update After Record Updated |
1/11/2009 8:02:38 PM |
PHPRunner General questions | |
C
chaintm author
This is probably very simple, but I am missing it. I wrote the following code. Works well for my first line in the inventory, however it doesn't finish the rest. IE< just does the first itemized invoice item then stops. I need ofcourse to have it complete the full order. This (if not obvious) returns rented inventory back the order once the user selects a pulldown menu to close the invoice. |
|
C
|
chaintm author 1/11/2009 |
This could be accomplished with a query statement could it not? |
C
|
chaintm author 1/12/2009 |
been looking into this, hmm would I not be able to basicly loop this with the where statement which looks up the particular items? |
J
|
Jane 1/13/2009 |
Please see my changes in Bold: if($values["Order_status"]==3) { global $conn; $str10 = "select from order_items where Order_num=".$keys["Order_num"]; $rs10 = CustomQuery($str10); while($data10 = db_fetch_array($rs10)) { $str12 = "select from order_items where ItemID='".$data10["ItemID"]."'"; $rs12 = CustomQuery($str12); $data12 = db_fetch_array($rs12); $str13 = "select * from items where ItemID='".$data10["ItemID"]."'"; $rs13 = CustomQuery($str13); $data13 = db_fetch_array($rs13); $strUpdate = "Update items set ItemStock=".$data13["ItemStock"]." + ".$data12["Qty_order"]." where ItemID='".$data13["ItemID"]."'"; db_exec($strUpdate,$conn); } } |
C
|
chaintm author 1/13/2009 |
Ahh the While statement, ee gads! I knew it was something easy! hehe thnx again Jane, the master of all code <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36778&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> |