Also, you don't register values, you register variables.

$id = 123;
$name = "leooi";

$_SESSION['id'] = $id; // same as session_register("id"), but better
$_SESSION['name'] = $name; // same as session_register("name"), but better

You could also skip the whole variable setting and just do this:

$_SESSION['id'] = 123;

What I like to do is this (and yes, I know, the brackets cause additional
overhead):

$r = db_query("select * from user where username='{$un}' and password='{$pw}'");
$_SESSION['user'] = mysql_fetch_object($r);

Now anything in the user table is now accessible in my session:

if ($_SESSION['user']->id) { do something for the user that's logged in }

Peter

On Thu, 5 Jun 2003, heilo wrote:

> well - this is not really a DB-question. and if you take a look at the
> php-docu at http://www.php.net/manual/en/language.variables.predefined.php
> you'd see that you can access and alter them with $_SESSION or
> $HTTP_SESSION_VARS (older versions of php).
>
> [EMAIL PROTECTED] <[EMAIL PROTECTED]> [EMAIL PROTECTED] 3:34 Uhr:
>
> > Hi all,
> > I had create a session and stored some value into session.
> > <?php
> > session();
> > session_register("id 123","name leooi");
> > ?>
> > How can i retrieved the value???

---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
[EMAIL PROTECTED]                             http://www.purplecow.com/
---------------------------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to