0
I’m getting beaten using arrays, I need to check values and make decisions depending on what I find in the list.
id | volume_total | volume_entregue | volume_restante
1 15 10 5
2 10 10 0
My problem is the following on this list:
If all the remaining volume_lines are (zero), then
$status = 'Todos Entregues'
If all the remaining volume_lines are equal to full volume_then
$status = 'Nenhum entregue'
If in one volume_remaining line you have (zero) and in another volume_remaining line you have a value equal to or less than volume_total, then
$status ='Entrega Parcial'
I can’t formulate if s in this scheme.
<?php
include "mysql.php";
$id = 13;
$sql = mysql_query ("SELECT * FROM ped_vendas_item WHERE id = '$id' ");
while ($r = mysql_fetch_array($sql)){
$volume_entregue[] =$r['volume_entregue'];
$volume_total[] = $r['volume_total'];
$volume_restante[] = $r['volume_restante'];
}
if ($volume_restante > 0 and $volume_restante == $volume_total) {
$status = "Todos Entregues";
} elseif ($volume_restante == 0){
$status = "Nenhum";
} elseif ($volume_restante > 0 and $volume_restante < $volume_total){
$status = "Entrega Parcial";
}
Image below, is to get a sense of what the listing is like.
Type: There may be multiple items, where some of these may be delivered to the customer wholly or partially or even an item on the list may not be delivered. I need to control this.
That one
id
in query is the order id or order item id? You want to know if the whole order has been delivered or separately from each item?– fernandosavio
Enjoy and tell us what’s going wrong. Your code isn’t getting the status right?
– fernandosavio