Jump to content

[SOLVED] If statement


Crustyfur

Recommended Posts

Hi,

 

I am a relative newbie to php so please be kind :)

 

I am trying to use the if statement to make a display based on comparing two values, pretty simple. Here's what I have:

 

if($ffor > $fagg)
echo " (L)";
elseif($ffor >= $fagg)
echo " (D)";
elseif($ffor < $fagg)
echo " (W)";
elseif(!empty($row[8]))
echo " ";

 

What I want it to do is not return any results when $ffar and $fagg are empty/null results. I am struggling as it keeps returning null values as a (D).

 

Any help would be appreciated.

 

Chris

Link to comment
https://forums.phpfreaks.com/topic/52191-solved-if-statement/
Share on other sites

<?php

if(!isset($ffor) || !isset($fagg)) { // If either is empty, just output a space. Then run the rest of your if's.
echo " ";
} elseif($ffor > $fagg) {
echo " (L)";
} elseif($ffor >= $fagg) {
echo " (D)";
} elseif($ffor < $fagg) {
echo " (W)";
} elseif(!empty($row[8])) {
echo " ";
} else {
echo " ";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/52191-solved-if-statement/#findComment-257390
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.