So, I am scratching my head on this one. My original “IF” statement is not executing when true (I know it’s true because I have echoed the variable and it’s what should trigger the code). BUT, if the IF statement is not true, the elseif and else statements work fine. Here is the code:
<?php
$count=mysql_num_rows($result);
// have also tried only one "=" sign//
if ($count==0){
//This is not appearing//
echo "Your search did not yield any results. Please try another search.";
} else if ( //other conditions// ) {
//code that is working fine//
} else {
// more code that is working fine
// (happens to be the same as the original if statement)
}
echo $count; //is printing 0 correctly, but the if statement for $count=0 not happening//
?>
Any ideas?
Ok, had a guy at work look at it and he found the error. It was in something I didn’t report because I didn’t think it would have an effect. I had a while statement before the original if, but I didn’t need it to execute unless the if was false. When I moved it to below the original if and changed elseif to another if bracketed within the while statement, it worked fine.