Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

testing php session

Links for php scripts

Moderators: macek, egami, gesf

testing php session

Postby peewster » Mon Nov 21, 2011 10:37 am

Hi all,

i'm working on a login script and therefore i needed to test something.

The thing is, what i like to test, doesn't seem to do what i want.

example:
Code: Select all
<?PHP
session_start();

$_session['count'] += 1; //doesn't work
//$_session['count'] = $_session['count'] + 1; //this doesn't work either

echo "This is the ". $_session['count']. " time you've seen this page";
echo "<br>";
echo "This is session: ".session_id()."<br />\n";
?>


The count stays on 1, but the session id keeps the same as it should. I expected the count going up when refreshing...

What am i doing wrong here ?
peewster
New php-forum User
New php-forum User
 
Posts: 11
Joined: Mon Oct 10, 2011 3:20 am

Re: testing php session

Postby egami » Mon Nov 21, 2011 12:18 pm

Well, this may come of a shock to you..
but variables are CASE SenSiTiVe. :)

$_SESSION is not the same as $_session
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: testing php session

Postby peewster » Tue Nov 29, 2011 1:34 am

egami wrote:Well, this may come of a shock to you..
but variables are CASE SenSiTiVe. :)

$_SESSION is not the same as $_session


lol, i just thought it was session with only non caps, but i got it all working :)
peewster
New php-forum User
New php-forum User
 
Posts: 11
Joined: Mon Oct 10, 2011 3:20 am


Return to PHP Scripts

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.