Re: Sessions

From: Date: Mon, 10 Jul 2000 18:02:08 +0000
Subject: Re: Sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-5770@lists.php.net to get a copy of this message
At first glance it looks like you are incrementing $count AFTER you are putting it into the session. So you visit the page, count = 0, you store 0 in the session, increment to 1, then display 1. If you increment first, you would visit the page, count = 0, increments to 1, stores 1 in the session, and displays 1. The next time it would increment to 2, etc... > <? > > // File name: count_me.php > > // if a session does not yet exist for this user, start one > > session_start(); > session_register('count'); > > $count++; > > echo "<p>You've been here $count times. Thanks!</p>"; > ?> > > I have this sample script that DOES NOT increament up each time I click > refresh? It stays at 1? > Thanks > Ray > > > > -- > 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

« previous php.general (#5770) next »