[Solved] PHP If Statement with Multiple Conditions and Results


You can do this with either a switch statement or an elseif:

if ($row['rank'] == 1 |){
    echo 'Administrator';
}
elseif ($row['rank'] == 2){
    echo 'Moderador';

}
elseif ($row['rank'] == 3) {
    echo 'Helper';

}else{
    echo "Not Ranked"; 
}

OR

switch ($row['rank']) {
  case 1:
    echo 'Administrator';
    break;
  case 2:
    echo 'Moderator';
    break;
  case 3:
    echo 'Helper';
    break;
  default:
    echo "Not Ranked";
}

solved PHP If Statement with Multiple Conditions and Results