problems with session variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Japhy

    problems with session variables

    hello,
    I am finding that setting session variables is very unreliable (for
    me).

    Am I doing something wrong with syntax :
    $contnum = getrequest("ID1 ") ; (ID1 is passed in the URL)
    $_SESSION['sess_contnum']= $contnum ;

    My program will randomly start to fail.
    If I echo $sess_contnum, sometimes it is set, sometimes not.

    I am using Apache 2.0.53 as a web server. Are there any parameters I
    should be aware of (more memory allocated for SV's or ?).

    thanks for any help!

  • Jerry Stuckle

    #2
    Re: problems with session variables

    Japhy wrote:[color=blue]
    > hello,
    > I am finding that setting session variables is very unreliable (for
    > me).
    >
    > Am I doing something wrong with syntax :
    > $contnum = getrequest("ID1 ") ; (ID1 is passed in the URL)
    > $_SESSION['sess_contnum']= $contnum ;
    >
    > My program will randomly start to fail.
    > If I echo $sess_contnum, sometimes it is set, sometimes not.
    >
    > I am using Apache 2.0.53 as a web server. Are there any parameters I
    > should be aware of (more memory allocated for SV's or ?).
    >
    > thanks for any help!
    >[/color]

    Japhy,

    Are you calling session_start() at the *beginning of every page* which
    uses sessions?

    This *must* be done before *any* output is sent to the browser if you're
    using cookie based sessions.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Japhy

      #3
      Re: problems with session variables

      Yes, I am....thanks for the thought

      Comment

      • Oli Filth

        #4
        Re: problems with session variables

        Japhy said the following on 11/10/2005 19:42:[color=blue]
        > hello,
        > I am finding that setting session variables is very unreliable (for
        > me).
        >
        > Am I doing something wrong with syntax :
        > $contnum = getrequest("ID1 ") ; (ID1 is passed in the URL)
        > $_SESSION['sess_contnum']= $contnum ;
        >
        > My program will randomly start to fail.
        > If I echo $sess_contnum, sometimes it is set, sometimes not.[/color]

        You shouldn't be using $x to access $_SESSION['x']. See
        PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.




        --
        Oli

        Comment

        • Japhy

          #5
          Re: problems with session variables

          Thanks. That helped me solve my 'reliability' problem, and as stated,
          is more secure.

          Comment

          Working...