refiking Posted October 9, 2008 Share Posted October 9, 2008 I echoed both variables to make sure and I am obviously missing something really simple. Here's what I have: IF ($num > $limit){ Echo 'It is workin'; } By the way, $num = 4 and $limit = 3 Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/ Share on other sites More sharing options...
Zane Posted October 9, 2008 Share Posted October 9, 2008 uh.....as far as I'm concerned. that looks fine to me....also it looks like a snippet of something what else is there, there is probably an error somewhere else Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660554 Share on other sites More sharing options...
Maq Posted October 9, 2008 Share Posted October 9, 2008 Do you get any errors? What is the output? And, as zanus said, post the entire script there's obviously something else wrong... Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660562 Share on other sites More sharing options...
refiking Posted October 9, 2008 Author Share Posted October 9, 2008 Here's the code. The script in and of itself works fine. It's this section here. Once again, everything else works fine. When I echo $num and $limit, I get 4 and 3 just like I am supposed to. $limit = $_POST['limit']; $value = $_POST['value']; IF ($value != ""){ $cl = mysql_query("SELECT * FROM `data` WHERE `$value` = 'yes'")or die(mysql_error()); $num = mysql_num_rows($cl); } IF ($num > $limit){ Echo 'It is workin'; } Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660566 Share on other sites More sharing options...
Maq Posted October 9, 2008 Share Posted October 9, 2008 Try this just to make sure... $limit = $_POST['limit']; $value = $_POST['value']; IF ($value != ""){ $cl = mysql_query("SELECT * FROM `data` WHERE `$value` = 'yes'")or die(mysql_error()); $num = mysql_num_rows($cl); } $num = 4; $limit = 3; IF ($num > $limit){ Echo 'It is workin'; } Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660571 Share on other sites More sharing options...
refiking Posted October 9, 2008 Author Share Posted October 9, 2008 Sorry guys. I had it inverted. $limit > $num : The things you miss when you've been coding for too many hours straight. LOL Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660573 Share on other sites More sharing options...
Zane Posted October 9, 2008 Share Posted October 9, 2008 you never did really tell us the problem..... you pretty much just said....IF statement don't work (*in a hillbilly accent* to make a point) what doesn't work about it...are you getting errors...are the values empty, is the page blank, is the ECHO not echoing.... I'd assume the echo is working but...well....Maq as pretty much solved that idea Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660575 Share on other sites More sharing options...
Zane Posted October 9, 2008 Share Posted October 9, 2008 cool, well glad you got it working Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660576 Share on other sites More sharing options...
Maq Posted October 9, 2008 Share Posted October 9, 2008 Just as I suspected, the error lies between the chair and the computer... Quote Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660578 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.