[Solved] Condition if elseif


you have to do something like this (assuming the array contains only 0,1,2) :

$containsOne = false;
$containstwo = false;

// first loop over all results to check the content of the array
foreach($results as $row){
     if ($row['age'] == 1){
          $containsOne = true;
     }              
     if($row['age'] == 2){
          $containsTwo = true;
     }
}

// once the loop is done, check the results and echo the correct message
if (!$containsOne && ! $containsTwo) echo 'OK';
if ($containsOne  && ! $containsTwo) echo 'Almost OK';
if ($containsTwo) echo 'Not OK';

6

solved Condition if elseif