Jump to content

session, coockie ! :(((


asmith

Recommended Posts

this book is now trying sessions , i've tried this :

 

<?php

session_start();

session_register('count');

$_session[count]++;

 

$msg="you've been here $_session[count] times";

?>

<html>

<head>

<title>start a session count</title>

</head>

<body>

<?php

echo $msg;

?>

</body>

</html>

 

 

when i load this page i only see,  you've been here 1 times,

by refreshing the page that number won't add up ! as the book says !

pleeease help !!

the only change i made for sessions was i did a little change in php.ini , session.save_path = c:/temp , now i can see some file in this directory with session type id ,  (have restart apache too)

but why neither cookie nor sessions are working ?? :((((((

Link to comment
Share on other sites

I notice you typed your session var as $_session['count'] PHP is case sensitive with variable names. $_session or $_SESSION or even $_SeSsIoN are three completely different variables.

 

When ever using any  superglobal variables (_POST, _GET, _SESSION, _COOKIE etc) always type in caps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.