array with sessions, only prints one letter

Posted by jolabero on Stack Overflow See other posts from Stack Overflow or by jolabero
Published on 2010-04-14T04:50:25Z Indexed on 2010/04/14 4:53 UTC
Read the original article Hit count: 161

Filed under:

On login:

$result = mysql_query("SELECT `id`, `username`, `email` FROM `users`
                   WHERE `username` = '$username'
        AND `password` = '$passwd'");
$userdata = array('id','username','email');
$_SESSION['user'] = mysql_result($result, 0, $userdata);

And when i want to print the users username

echo $_SESSION['user']['username']

it only prints the first letter :/

whats wrong`?

© Stack Overflow or respective owner

Related posts about array