xyn Posted July 3, 2006 Share Posted July 3, 2006 Hi Guys,Right I have got one minor problem nothing to big or hard butI just don't understand what I'm doing wrong. On my Login pageI set two sessions:1. being $_SESION['LoggedIn'] = true;and 2. being $_SESSION['username'] = $user; ($user being the user field)Well When i include my Sessions code ie checking if the sessionLoggedIn is true, I also have the Username Session. When I use:[code=php:0]echo $username;[/code] or [code=php:0]echo $_SESSION['username'];[/code]It outputs:[b]Array[/b] ??? Quote Link to comment https://forums.phpfreaks.com/topic/13548-sql-glitch/ Share on other sites More sharing options...
zq29 Posted July 3, 2006 Share Posted July 3, 2006 How are you setting the variables? Somehow you are creating them as arrays. You can view the structure of your arrays with something like...[code]<?phpecho "<pre>";print_r($array);echo "</pre>";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13548-sql-glitch/#findComment-52451 Share on other sites More sharing options...
xyn Posted July 3, 2006 Author Share Posted July 3, 2006 it's confusing because I didn't create an array... Quote Link to comment https://forums.phpfreaks.com/topic/13548-sql-glitch/#findComment-52460 Share on other sites More sharing options...
wildteen88 Posted July 3, 2006 Share Posted July 3, 2006 How is $user being created? Are doing something like thios:[code=php:0]$user = mysql_fetch_array[/code] or [code=php:0]$user = mysql_fetch_row[/code]If you did then mysql_fetch_array and mysql_fetch_row will store the result in an array within the $user variable.If you want to just store the username then do this:[code=php:0]$user = mysql_fetch_array($result);$_SESSION['username'] = $user['username'];$_SESSION['password'] = $user['password'];[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13548-sql-glitch/#findComment-52474 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.