Do this instead:
$user = mysql_fetch_object($sql_result);
$_SESSION['user'] = $user;
Then, you can use stuff like:
print "{$_SESSION[user]->name}";
// or if register_globals is on
print "$user->name"; // which is nice because you don't have to {} the var or
".$var[name]."
Peter
On Fri, 1 Nov 2002, wade wrote:
> How would one go about registering a session if you were to create
> the session based on the users ID and NAME from the database.
>
> I have the users ID and NAME already being pulled from the database
> and being stored in variables named $id and $name.
>
> I have latest version of PHP so I think I need to use the $_SESSION[]
> instead of session_register.
>
> I am also using the session_encode function to echo out the session that
> is currently being stored. What I am trying to store and what I am
> actually seeing printed to the page is entirly different.
>
> if (mysql_num_rows($sql_result) == 1)
> {
> session_start();
> list($id, $name) = mysql_fetch_row($sql_result);
> $SESSION_ID = $id;
> $SESSION_NAME = $name;
>
> session_register("SESSION_ID");
> session_register("SESSION_NAME");
> header("Location:");
> }
> else
> {
> header("Location:");
> exit;
> }
>
> --
> Should you have any questions, comments or concerns, feel free to call
> me at 318-338-2033.
>
> Thank you for your time,
>
> Wade Kelley, Design Engineer
> ================================================
> Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
> Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
> Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com
> ================================================
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
---------------------------------------------------------------------------
Peter Beckman Systems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---------------------------------------------------------------------------
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php