Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8997387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:52:57+00:00 2026-06-15T23:52:57+00:00

This statement works fine if I only use it once, but not when I

  • 0

This statement works fine if I only use it once, but not when I need to use it several times. I’m curious as to why, but more importantly I would like to know how I can get around that.

<?php if (isset($_SESSION['SESS_USER_ID'])) { ?>         
<?php }  
else {?>
<?php } 

I need to change several items on the page depending upon whether or not the user is logged in (menu items, messages to the user, etc.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:52:58+00:00Added an answer on June 15, 2026 at 11:52 pm

    Quick way around it would be:

    <?php $logged_in = (isset($_SESSION['SESS_USER_ID'])); ?>
    

    then

    <?php if ($logged_in) : ?>
       //show secret stuff
    <?php else : ?>
       // show public stuff
    <?php endif; ?>
    

    BUT

    There is something wrong going on between the first time you access $_SESSION and the second time. You are accidentally setting it somewhere (using = instead of == is an easy way), or you have code with side-effects that is changing it behind the scenes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This statements works fine in BASH v. 4.1.7(1), but not in BASH v. 4.2.20(1)
I want to use find_or_create_by, but this statement does NOT work. It does not
I'm using this statement in SQLServer and it works fine: SELECT TOP 1000 *
I currently have this sql statement that I wrote and it works but it's
Can an if statement have more than one then statements? # this works a
This is my update statement which works perfectly. If table 1 and table 2
I have problems running a dynamic LIKE statement in my project: this query works
I am trying to make this IF statement work, but I can't seem to
I'm unable to get this jquery statement to work on page load but it
I need for this to work in a single format statement and to work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.