Jump to content

Recommended Posts

when i do $_SESSION['level'] = $row['level']; i would expect what is in my database in the row 'level' should get stored into that. unfortunatly that doesnt happen and i dont know why.

 

when i <? print_r($_SESSION)?>  i get this array - Array ( [level] => [status] => logged [username] => test ) and as you can see level doesnt appear.

 

could someone advise why it doesnt appear?

 

thanks in advance

Either $row['level'] is empty or non-existent or you have some php code that is overwriting $_SESSION['level'], such as if($_SESSION['level'] = '') (one =, an assignment) instead of if($_SESSION['level'] == '') (two ==, a comparison)

 

It would take seeing your relavant code and data that both sets $row['level'] in your database to the expected value, retrieves $row['level'], assigns the value to $_SESSION['level'] and any code that references $_SESSION['level'] up to the point where you determined that is is empty, to be able to determine what the most likely cause of the problem is.

 

Edit: Short answer - you have access to both your database and your code, you should be able to determine at what point your data and variables have the expected value and at what point they don't. I can guarantee that the code between those two points is where the problem is.

thanks for the reply.  on my login page i have these session variables:

 

$_SESSION['level'] = $row['level'];

$_SESSION['status'] = 'logged';

$_SESSION['username'] = $n;

 

on my admin page i have this:

 

<? if($_SESSION['level'] == "Admin") {?>

 

in my database the row 'level' does have Admin in it or Normal so it deffinatly isnt empty.  i have trolled through all my other pages and cant find anything to do with $_SESSION['level'] anywhere else so i cant see why it would be over written.

 

is there any more of the code you would want to see?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.