Various conditions in if PHP

0

I'm doing a query in which I bring a value from the database:

<?php
if($fila['uno'] <= 4) {
?>

It's simple, what it does is alert in red if a value is equal to or less than 4. The issue is that I try to add more data to the if and it results in all the values in red.

<?php
if($fila['uno'] || $fila['dos'] || $fila['tres'] <= 4) {
?>

This is what I do and try to do this:

<?php
if($fila['uno'] & $fila['dos'] & $fila['tres'] <= 4) {
?>

And it gives me as a result the number in black without putting in red those that are 4 and less than 4

    
asked by alo Malbarez 19.06.2018 в 00:52
source

2 answers

0

If each value must meet the condition of being

answered by 19.06.2018 / 05:57
source
0

Your conditionals are incorrect. For the effect you want, you should do it like this:

<?php
  if($fila['uno'] <= 4 || $fila['dos'] <= 4 || $fila['tres'] <= 4) {
?>
    
answered by 19.06.2018 в 00:54