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? 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 ? 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, 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... 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
Archived
This topic is now archived and is closed to further replies.