i want update values of beginning , ending if user enter existing product. there wrong in update query? thanks!
if(isset($_post['status2'])){ $rowvalues = explode("//", $_post['status2']); $orderid = $rowvalues[0]; $datereceivedno = $rowvalues[1]; $receiveddate = $_post[$datereceivedno]; mysqli_query(connect(), "update `order` set `status` = 'received' `order_id` = '$orderid'"); $product = mysqli_query(connect(), "select * `order` `order_id` = '$orderid' , branch_name = '$name' "); $product2 = mysqli_fetch_assoc($product); $cate = $product2['cat_name']; $item = $product2['item_name']; $prodname = $product2['product_name']; $quantity = $product2['quantity']; mysqli_query(connect(), "insert `logs`(`log_id`, `branch_name`, `activity`, `date`) values ('', '$name', 'received item ".$prodname. " ". $quantity ."', now())"); $count = mysqli_query(connect(), "select count(invbranch_id) 'countitems' `inventorybranch` `cat_name` = '$cate' , `item_name` = '$item' , `product_name` = '$prodname'"); $count2 = mysqli_fetch_assoc($count); if($count2['countitems'] > 0){ mysqli_query(connect(), "update `inventorybranch` set `beginning` = (`beginning` + '$quantity'), `date` = now() `cat_name` = '$cate' , `item_name` = '$item' , `product_name` = '$prodname' , `status` = 'delivered'"); mysqli_query(connect(), "update `inventorybranch` set `quantity` = (`quantity` + '$quantity'), `date` = now() `cat_name` = '$cate' , `item_name` = '$item' , `product_name` = '$prodname' , `status` = 'delivered'"); } else{ mysqli_query(connect(), "insert `inventorybranch` values ('','','$cate','','$item','','$prodname','$name','$quantity','$quantity','','','', now())"); } mysqli_query(connect(), "update `inventoryho` set quantity = (quantity-'$quantity') cat_name = '$cate' , item_name = '$item' , product_name = '$prodname'"); mysqli_query(connect(), "update `order` set `date_receive` = now() `order_id` = '$orderid'"); }
Comments
Post a Comment