I am trying to retrieve some info from the DB.
I have the following table
orderNo item shipping
1050 1 0000-00-00
1050 2 0000-00-00
1050 6 2016-09-18
2000 2 0000-00-00
2006 1 2016-09-05
2006 2 0000-00-00
//adding the shipping date to item 2
$sql = "UPDATE orders
SET shipping = '".$shipping."'
WHERE orderNo = '".$orderNo."' AND item = '2'";
//add some kind of query to check whether shipping of rest items is not zero. If it is '0000-00-00' then do not proceed
SELECT orderNo FROM orders WHERE orderNo = '".$orderNo."' AND shipping in other items than 2 has a date
//If query returns true then proceed and execute the following
$new_payment = new itemPayment();
//else do nothing
An understandable way to do this, is going for a query:
SELECT orderNo FROM orders WHERE orderNo = '".$orderNo."' AND item !=2 AND shipping>'0000:00:00'
Then run php num rows to see how many rows match to your query. If the result is more than 0, that means you should not proceed