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 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 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... 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'; } 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'; } 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 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 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 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... Link to comment https://forums.phpfreaks.com/topic/127648-solved-if-statement-issue/#findComment-660578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.