| | |
if isset ==
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I'm trying to display a menu option only for certain session id's and for some reason it displays for ALL session id's ... not just the ones i have indicated. Not too sure why it's doing this, it all looks okay to me.
Any ideas?
PHP Syntax (Toggle Plain Text)
<?PHP if(isset($_SESSION['user_id']) && $_SESSION['user_id'] == 1 || 68) {?> <li><span class="qmdivider qmdividery" ></span></li> <li><a class="qmparent" href="javascript:void(0);">ADMIN</a> <ul style="width:150px;"> <li><a href="/admin/">Admin Home</a></li> <li><span class="qmdivider qmdividerx" ></span></li> <li><span class="qmtitle" >Hit Counter</span></li> <li><a href="javascript:void(0);">Today <?=$hcount?></a></li> <li><span class="qmdivider qmdividerx" ></span></li> </ul></li> <? } ?>
•
•
Join Date: Aug 2009
Posts: 49
Reputation:
Solved Threads: 8
1
#2 Nov 3rd, 2009
Your problem is with the "|| 68":
It's like you're asking
Also, you may want to add another set of parenthesis to group the last two logical operations together:
- EF
if(isset($_SESSION['user_id']) && $_SESSION['user_id'] == 1 || 68) . It should be: php Syntax (Toggle Plain Text)
if(isset($_SESSION['user_id']) && $_SESSION['user_id'] == 1 || $_SESSION['user_id'] == 68)
It's like you're asking
if(68) , which will of course return true. You need to compare the 68 to $_SESSION['user_id']Also, you may want to add another set of parenthesis to group the last two logical operations together:
php Syntax (Toggle Plain Text)
if(isset($_SESSION['user_id']) && ($_SESSION['user_id'] == 1 || $_SESSION['user_id'] == 68))
- EF
Last edited by EvolutionFallen; Nov 3rd, 2009 at 10:46 pm.
![]() |
Similar Threads
- isset $_POST troubles (PHP)
- submit and isset (PHP)
- (isset($_POST['submitted'])) not working, not sure why (PHP)
- Strangest behavior regarding isset (PHP)
Other Threads in the PHP Forum
- Previous Thread: Age Calculation
- Next Thread: Deleting rows
Views: 305 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code codingproblem cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms soap source space speed sql static structure syntax system table tutorial up-to-date update updates upload url validation validator variable video web wordpress xml youtube





