iceblox Posted July 20, 2007 Share Posted July 20, 2007 Hi Guys, Im stuck on an if query. Basically if row[7] = 0 dont show anything but if row[5] = 0.00 show XX else show XXX But i seem to be finding that the code is ignoring the first if and skipping to the next row with some results. if($row[7] == "0") { echo''; } else if($row[5] == "0.00") { echo' with <font color="#FF0000">' . $row[7] . ' Months FREE Line Rental</font>'; } else { echo'' . $row[7] . ' Months at ' . $row[5] . ''; } Anyone got any ideas? Link to comment https://forums.phpfreaks.com/topic/60984-solved-please-help-with-this-if-query/ Share on other sites More sharing options...
phat_hip_prog Posted July 20, 2007 Share Posted July 20, 2007 Maybe your number is set as a float, you could try 'gettype()' to see if it's an integer? Link to comment https://forums.phpfreaks.com/topic/60984-solved-please-help-with-this-if-query/#findComment-303440 Share on other sites More sharing options...
lewis987 Posted July 20, 2007 Share Posted July 20, 2007 if($row['7'] == "0") { echo''; } elseif($row['5'] == "0.00") { echo ' with <font color="#FF0000">' . $row['7'] . ' Months FREE Line Rental</font>'; } else { echo $row['7'] . ' Months at ' . $row['5']; } that code will work, u put a space between elseif and you didnt put '' arround the numbers Link to comment https://forums.phpfreaks.com/topic/60984-solved-please-help-with-this-if-query/#findComment-303443 Share on other sites More sharing options...
iceblox Posted July 20, 2007 Author Share Posted July 20, 2007 Thanks Lewis, I think i completed things with all the if statements lol i changed what you said and removed some unused ifs and sorted it. So thanks for your help again Lewis! Phil Link to comment https://forums.phpfreaks.com/topic/60984-solved-please-help-with-this-if-query/#findComment-303493 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.