RE: [PHP] Session problem
| From: | Chad Day | Date: | Tue, 07 Aug 2001 13:16:15 +0000 |
| Subject: | RE: [PHP] Session problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61608@lists.php.net to get a copy of this message | ||
I tried this, I still have the same problem. Is this a bug in the version
of PHP I am running?
Chad
-----Original Message-----
From: mike cullerton [mailto:php-l@bakednotfried.com]
Sent: Monday, August 06, 2001 4:58 PM
To: Chad Day; php-general@lists.php.net
Subject: Re: [PHP] Session problem
i would try
session_start();
session_register("NAME");
$res = mysql_query("SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
PASSWORD = '$PASSWORD'");
if ($row = mysql_fetch_array($res)) {
$NAME = $row[NAME];
}
notice that $NAME is registered before being assigned to.
on 8/6/01 2:23 PM, Chad Day at cday@atpco.com wrote:
> PHP 4.0.2 ..
>
> I have a very basic script, gets the user's name, registers it, then
> displays "Welcome, $NAME." $NAME is the session registered name.
>
> If I constantly reload that page that says Welcome, sometimes $NAME
appears,
> sometimes not. Completely random. It just loses track of the variable.
>
> My code:
>
> auth.php:
>
> session_start();
>
> ...
>
> $res = mysql_query("SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
> PASSWORD = '$PASSWORD'");
>
> if ($row = mysql_fetch_array($res)) {
> $NAME = $row[NAME];
> session_register("NAME");
> }
>
> ...
>
> Header("Location: menu.php");
>
>
>
> menu.php:
>
> session_start();
>
> echo "Welcome, $NAME";
>
>
>
> So like, what the hell. Why would it keep losing track of $NAME?
>
> Thanks,
> Chad
>
-- mike cullerton
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net