Page 1 of 1

session is working?

Posted: Thu Jul 01, 2004 8:52 pm
by pelegk2
how can i chck if session works
when igo from 1 page to another?
is there a way to get the session id and to check if it realy saves the data u give it
thnaks in advabce
peleg

Posted: Thu Jul 01, 2004 8:54 pm
by tim
add this to the top of the page

Code: Select all

<?php
<pre>
print_r($_SESSION);
</pre>
?>

well i did ass u told me and it gave me an error so i did

Posted: Sun Jul 04, 2004 2:29 am
by pelegk2

Code: Select all

<?php
  session_start();
print_r($_SESSION);
?>
and i get :
Array()
how can i make it print all the data?

Posted: Sun Jul 04, 2004 6:43 am
by wwwapu
It does print all the data. Your $_SESSION is empty. Did you start session on your first page?

Posted: Sun Jul 04, 2004 6:50 am
by tim
you have no session vars


are u sure session_start(); is located on every page?

Posted: Mon Jul 05, 2004 2:01 am
by pelegk2
yep

Posted: Mon Jul 05, 2004 2:04 am
by markl999
Does the following work for you? (counter should increment every time you refresh)

Code: Select all

<?php
error_reporting(E_ALL);
session_start();
if(empty($_SESSION['count'])){
  $_SESSION['count'] = 0;
}
echo ++$_SESSION['count'];
?>

Posted: Mon Jul 05, 2004 2:07 am
by pelegk2
ok works thanks alot
i maybe did something wrong before