thndr Posted December 8, 2008 Share Posted December 8, 2008 Hy everyone I have a small piece of code thats not working and I have no clue why. <?php echo "<br>admin=".$row['admin']."<br>"; echo "adminnotification=".$row['adminnotification']."<br>"; if (($row['admin'] == 1 ) && ($_row['adminnotification'] == 1)){ echo "admin and notification enabled"; }elseif (($row['admin'] == "1" ) && ($_row['adminnotification'] == "0")){ echo "admin enabled but notification is disabled"; }else{ //notadmin echo "not admin"; }?> Now the first part dumps the value of the MySql query and it returns: admin=1 adminnotification=1 So it should trigger the first part of the If statement, but it does not. It triggers the "else", ie nothing is set. Anyone have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/136091-solved-conditional-statement-not-triggering-dont-know-why/ Share on other sites More sharing options...
Maq Posted December 8, 2008 Share Posted December 8, 2008 Yeah shouldn't $_row be: $row ? Quote Link to comment https://forums.phpfreaks.com/topic/136091-solved-conditional-statement-not-triggering-dont-know-why/#findComment-709612 Share on other sites More sharing options...
thndr Posted December 8, 2008 Author Share Posted December 8, 2008 Wow. Thank you. Its amazing how you can overlook something so simple. Thanks again, Quote Link to comment https://forums.phpfreaks.com/topic/136091-solved-conditional-statement-not-triggering-dont-know-why/#findComment-709617 Share on other sites More sharing options...
Maq Posted December 8, 2008 Share Posted December 8, 2008 It amazes me every time... Quote Link to comment https://forums.phpfreaks.com/topic/136091-solved-conditional-statement-not-triggering-dont-know-why/#findComment-709621 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.