Re: [PHP] Sessions - More Info

2011-03-31 Thread Boers Steven



Dear List -

Thank you for your help in the past.  This an update on my session 
problems.


Here is a simple test program.  It never increments the session counter; 
ie, does not detect that $_SESSION has been set.




"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>







I have no idea what is wrong.

I need to make my session variables work so that I can finish a project.

Help and advice, please.

Ethan Rosenberg

MySQL 5.1  PHP 5.3.3-6  Linux [Debian (sid)]

I tried your code on my testing computer (PHP 5.2.14) and everything works 
fine. $_SESSION['views'] is counting up correctly. Maybe a problem with your 
configuration?


Beste regards.
Steven


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sessions - More Info - SOLVED

2011-03-30 Thread Ethan Rosenberg

At 07:28 PM 3/30/2011, Ashley Sheridan wrote:

On Wed, 2011-03-30 at 19:20 -0400, Ethan Rosenberg wrote:

> Dear List -
>
> Thank you for your help in the past.  This an update on my 
session problems.

>
> Here is a simple test program.  It never increments the session
> counter; ie, does not detect that $_SESSION has been set.
>
> 
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
>
> 
>
> if(isset($_SESSION['views']))
> $_SESSION['views']=$_SESSION['views']+1;
> else
> $_SESSION['views']=1;
> echo "Views=". $_SESSION['views'];
> ?>
>  
> 
>
> I have no idea what is wrong.
>
> I need to make my session variables work so that I can finish a project.
>
> Help and advice, please.
>
> Ethan Rosenberg
>
> MySQL 5.1  PHP 5.3.3-6  Linux [Debian (sid)]
>
>
>


That code works perfectly for me, only thing I would change is the

$_SESSION['views']=$_SESSION['views']+1;

line to

$_SESSION['views']++;

for readability. If you're using Firefox, grab the Firebug plugin, which
should show you the headers that are being sent to and from the server
to the browser. From that, you might get an idea why the sessions don't
seem to be working. Just to make sure, turn on display_errors in your
php.ini file and restart Apache. Some whitespace (space or new line, for
example) before that first http://www.ashleysheridan.co.uk


++
Ash -

Thanks.

What did it was to 1] explicitly declare the character set and 2] 
close and restart Apache.


Ethan 




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sessions - More Info

2011-03-30 Thread Ashley Sheridan
On Wed, 2011-03-30 at 19:20 -0400, Ethan Rosenberg wrote:

> Dear List -
> 
> Thank you for your help in the past.  This an update on my session problems.
> 
> Here is a simple test program.  It never increments the session 
> counter; ie, does not detect that $_SESSION has been set.
> 
> 
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> 
>  
> 
> if(isset($_SESSION['views']))
> $_SESSION['views']=$_SESSION['views']+1;
> else
> $_SESSION['views']=1;
> echo "Views=". $_SESSION['views'];
> ?>
>  
> 
> 
> I have no idea what is wrong.
> 
> I need to make my session variables work so that I can finish a project.
> 
> Help and advice, please.
> 
> Ethan Rosenberg
> 
> MySQL 5.1  PHP 5.3.3-6  Linux [Debian (sid)] 
> 
> 
> 


That code works perfectly for me, only thing I would change is the

$_SESSION['views']=$_SESSION['views']+1;

line to

$_SESSION['views']++;

for readability. If you're using Firefox, grab the Firebug plugin, which
should show you the headers that are being sent to and from the server
to the browser. From that, you might get an idea why the sessions don't
seem to be working. Just to make sure, turn on display_errors in your
php.ini file and restart Apache. Some whitespace (space or new line, for
example) before that first http://www.ashleysheridan.co.uk