Re: Sessions and Arrays
| From: | Jim Lucas | Date: | Tue, 08 Apr 2003 16:33:07 +0000 |
| Subject: | Re: Sessions and Arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142907@lists.php.net to get a copy of this message | ||
are you remembering to run session_start() at the top of your script?
Jim
----- Original Message -----
From: "Erich Kolb" <ekolb@randbreceivables.com>
To: "'Negrea Mihai'" <mike@spidernet.co.ro>;
<php-general@lists.php.net>
Sent: Tuesday, April 08, 2003 9:26 AM
Subject: RE: [PHP] Sessions and Arrays
> There is no output for "echo $_SESSION['AppUI']['user_id'];"
>
> Eg. If I do:
> $user_identifier = $_SESSION['AppUI']['user_id'];
> if (!$user_identifier){
> echo "Nothing in the variable";
> exit;
> }
>
> I get the "Nothing in the variable" Error, and the script ends.
>
> -----Original Message-----
> From: Negrea Mihai [mailto:mike@spidernet.co.ro]
> Sent: Tuesday, April 08, 2003 11:24 AM
> To: Erich Kolb; php-general@lists.php.net
> Subject: Re: [PHP] Sessions and Arrays
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> echo $_SESSION['AppUI']['user_id'];
>
> On Tuesday 08 April 2003 07:20 pm, Erich Kolb wrote:
> > If I do:
> >
> > while (list($key,$val) = each($_SESSION['AppUI'])) {
> > echo $key." ".$val."<br />";
> > }
> >
> > I get:
> >
> > state Array
> > user_id 5
> > user_first_name Erich
> > user_last_name Kolb
> > user_company 1
> > user_department 1
> > user_type 1
> > user_prefs Array
> > project_id 0
> > day_selected Object
> > user_locale en
> > base_locale en
> > locale_warn
> > locale_alert ^
> > styles Array
> > msg
> > msgNo 0
> > defaultRedirect
> > cfg Array
> >
> > How do I get the value from the above "user_id" into a variable so
> > that I can echo it, or use it to perform a db query, etc.?
>
> - --
> Negrea Mihai
> http://www.negrea.net
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
>
> iD8DBQE+kvef8hhhNOp8KlQRAgLqAKCr4vgM7HzYzcGx3AqoKBpJOgP7tACgjUDB
> KZVizZWN5ZDSOEhXF+ojvqo=
> =wJCR
> -----END PGP SIGNATURE-----
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>