| | |
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: 47
Reputation:
Solved Threads: 8
1
#2 23 Days Ago
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; 23 Days Ago 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
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





