reel_biggy_fish Posted July 3, 2010 Share Posted July 3, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/206648-_sessionlevel-rowlevel-never-stores-anything/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 3, 2010 Share Posted July 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/206648-_sessionlevel-rowlevel-never-stores-anything/#findComment-1080786 Share on other sites More sharing options...
reel_biggy_fish Posted July 3, 2010 Author Share Posted July 3, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/206648-_sessionlevel-rowlevel-never-stores-anything/#findComment-1080792 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.