Board index   FAQ   Search  
Register  Login
Board index PHP PHP Installation

session variables loses its values

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

session variables loses its values

Postby Mazerman » Thu May 01, 2003 5:30 am

Hi!

I think I have got some problems with the configuration files or something. If I start a session, registers a variable and gives it a value. Later when I try to get the value from the session variable it is empty.
Here's a simple counter that should be enumerated every time key-button F5 is pressed. But it keeps printing Hello 0 every time. Have tried it on other computers and it works but on my computers it wont work. Would be thankful if someone could please help me. Thanks in advance!

Code: Select all
<?php
   // start a session if there aren't an existing one
   session_start();
   
   if (!isset($_SESSION['count']))
   {
      $_SESSION['count'] = 0;
   }
   else
   {
      $_SESSION['count']++;
   }
   
   echo "Hello " .$_SESSION['count'];
?>
Mazerman
New php-forum User
New php-forum User
 
Posts: 12
Joined: Sun Jan 26, 2003 2:57 pm
Location: Sweden

Re: session variables loses its values

Postby WiZARD » Tue May 06, 2003 5:19 am

Try to see php.ini
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP Installation

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.