Jump to content

SQL Glitch


xyn

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.