Jump to content

Recommended Posts

Hi Guys,
Right I have got one minor problem nothing to big or hard but
I just don't understand what I'm doing wrong. On my Login page
I 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 session
LoggedIn 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]
???
Link to comment
https://forums.phpfreaks.com/topic/13548-sql-glitch/
Share on other sites

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]
Link to comment
https://forums.phpfreaks.com/topic/13548-sql-glitch/#findComment-52474
Share on other sites

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.