envexlabs Posted July 4, 2007 Share Posted July 4, 2007 Hello, I am having problems with my elseif statment. $c = 10 and $count_nonum = 24 Even though $c (24) is = lessthan (>) $count_nonum ($24) is still moves onto the else statment. am i overlooking some minut detail, or is something wrong? //creates the next and previous buttons to only show 10 messages if($c == 0) { //no previous button echo('<img src="images/icons/control_start.gif" height="16px" width="16px" alt="" />'); //previous echo(" | "); counter($table, $search, $have_submitted, $white, $yellow); echo(" | "); echo('<a href="?c=' . $c = $c + 10 .'&search=' . $search . '&search_param=' . $table . '&have_submitted=' . $have_submitted . '&x=0&y=0&white=' . $white . '&yellow=' . $yellow . '"><img src="images/icons/control_end_blue.gif" height="16px" width="16px" alt="" /></a>'); //next } elseif($c > $count_nonum) { //all buttons echo('<a href="?c=' . ($c - 10) . '&search=' . $search . '&search_param=' . $table . '&have_submitted=' . $have_submitted . '&x=0&y=0&white=' . $white . '&yellow=' . $yellow . '"><img src="images/icons/control_start_blue.gif" height="16px" width="16px" alt="" /></a>'); //previous echo(" | "); counter($table, $search, $have_submitted, $white, $yellow); echo(" | "); echo('<a href="?c=' . ($c + 10) . '&search=' . $search . '&search_param=' . $table . '&have_submitted=' . $have_submitted . '&x=0&y=0&white=' . $white . '&yellow=' . $yellow . '"><img src="images/icons/control_end_blue.gif" height="16px" width="16px" alt="" /></a>'); //next } else{ //no next button echo('<a href="?c=' . ($c - 10) . '&search=' . $search . '&search_param=' . $table . '&have_submitted=' . $have_submitted . '&x=0&y=0&white=' . $white . '&yellow=' . $yellow . '"><img src="images/icons/control_start_blue.gif" height="16px" width="16px" alt="" /></a>'); //previous echo(" | "); counter($table, $search, $have_submitted, $white, $yellow); echo(" | "); echo('<img src="images/icons/control_end.gif" height="16px" width="16px" alt="" />'); //next } Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 You have your operators the wrong way round < less than > greater than <= less than or equal to >= greater than or equal to == equal to != not equal to Quote Link to comment Share on other sites More sharing options...
envexlabs Posted July 4, 2007 Author Share Posted July 4, 2007 are you sure, because the code is being read left to right, which would make >= less than, because the mouth is closing. i may be completely wrong, but it seems like that is backwards to me. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 I've been programming for almost 27 years in compiled, interpreted and assembled languages as well as server scripts including PHP. Yes, definitely sure. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 4, 2007 Share Posted July 4, 2007 Even though $c (24) is = lessthan (>) $count_nonum ($24) is still moves onto the else to Even though $c (24) is > lessthan (=) $count_nonum ($24) is still moves onto the else => Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 if (10<5) {echo 'A';} else {echo 'B';} What do you think would be displayed? A or B? It's B as 10 is not lower than 5. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 4, 2007 Share Posted July 4, 2007 love it f (empty($coffee)) {$coffee=new coffee();} Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 What more can I say - I live for caffeine Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.