[thelist] PHP sessions syntax

rahaman rahaman29 at gmail.com
Sun Jul 22 07:28:31 CDT 2007


hi nan,
              to register session, u can use session_register("user_id")

but in everypage u have to use

session_start() to extract the session variable ..





On 7/22/07, Nan Harbison <nan at nanharbison.com> wrote:
>
> Hi All,
> I need to use sessions in a website I am working on. I am finding
> conflicting information on this when I google for it. One major problem is
> that many of the articles I have found were written in 2003 or earlier,
> and
> the books I have lying around my office are older too. (I am using PHP
> Version 4.3.11)
> My question is how to correctly set session variables.
>
> I have always used:
> session_register ('user_id');
> session_register ('first_name');
>
> but now I have read you can just set session vars to something, like:
> $_SESSION["first_name"] = "Nan";
> Is the way I have always used been deprecated or can I still safely use
> it?
>
> Another question, do I need to use:
> ["real_name"], ['real_name'] or [real_name] - double or single quotes, or
> no
> quotes. IIRC, $HTTP_SESSION_VARS did not use quotes at all. I have seen
> single and double quotes used, but don't know if there is a difference?
>
> TIA
> Nan
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list