I have a problem, I'm a PHP starter, I have a table where I keep the items that contain an order.
Each item is marked as YES, if it has already been distributed, and it is marked as YES if it has already been delivered, since this may happen another day.
What I need is to know how to make the query and how to print a button for example, if all the items are = YES and YES then a button that says CLOSE THE SALE, since they were all delivered and delivered.
oder_product
+-----+-----+-----+-----+-----+------+
| id | item_id | reparto | entregado |
======================================
| 1 | 1 | SI | NO |
======================================
======================================
| 2 | 2 | SI | SI |
======================================
| 3 | 2 | SI | SI |
======================================
| 4 | 2 | SI | SI |
======================================
| 5 | 2 | SI | SI |
======================================
======================================
| 6 | 3 | SI | NO |
======================================
| 7 | 3 | SI | SI |
======================================
and well I'm stuck from here, I can select all, but how does PHP know they are all really?
SELECT * FROM oder_product WHERE reparto="SI" AND entregado="SI" AND item_id="2";
PHP I think it would be something like this:
If result=all rows match;
Echo' Todos coinciden AQUI BOTON CERRAR VENTA';
else
Echo' No todos coinciden, faltan $result2 para coincidir;
I hope to have explained myself well, I take help in MySql syntax if it uses a type of COUNT and in PHP.