godrob Posted September 5, 2011 Share Posted September 5, 2011 Hi Guys, I'm learning PHP and could do with some help with combining two conditions please. <?php if(!is_page( array( 100, 1773, 1791, 1778, 1784 ) ) ) OR (!current_user_can("access_s2member_level0")) { echo 'CONTENT TO SHOW'; } ?> When I try to access the page I get: Parse error: syntax error, unexpected T_LOGICAL_OR in ..... Any help appreciated Thanks Rob Quote Link to comment https://forums.phpfreaks.com/topic/246474-parse-error-syntax-error-unexpected-t_logical_or-in/ Share on other sites More sharing options...
Pikachu2000 Posted September 5, 2011 Share Posted September 5, 2011 Too many parentheses in the first half, not enough in the second. Quote Link to comment https://forums.phpfreaks.com/topic/246474-parse-error-syntax-error-unexpected-t_logical_or-in/#findComment-1265657 Share on other sites More sharing options...
godrob Posted September 5, 2011 Author Share Posted September 5, 2011 Thanks for your reply. Okay so if I modify my code to this: <?php if(current_user_can("access_s2member_level1") OR (!is_page( array( 100, 1773, 1791, 1778, 1784 ) ) ) ) { echo '<link type="text/css" rel="stylesheet" id="arrowchat_css" media="all" href="/arrowchat/external.php?type=css" charset="utf-8" />'; echo '<script type="text/javascript" src="/arrowchat/includes/js/jquery.js"></script>'; echo '<script type="text/javascript" src="/arrowchat/includes/js/jquery-ui.js"></script>'; } ?> The Javascript still shows when it shouldn't. However, if I isolate the code to just one query ie, use just current_user_can or !is_page , they work fine independently. What am I doing wrong? Thanks Rob. Quote Link to comment https://forums.phpfreaks.com/topic/246474-parse-error-syntax-error-unexpected-t_logical_or-in/#findComment-1265691 Share on other sites More sharing options...
Pikachu2000 Posted September 5, 2011 Share Posted September 5, 2011 Without knowing what those two functions are, what data is being passed to them, what the expected results versus the results you're getting are, and what the actual code is, there's no way to know for sure. Quote Link to comment https://forums.phpfreaks.com/topic/246474-parse-error-syntax-error-unexpected-t_logical_or-in/#findComment-1265700 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.