Trouble with Sessions and file locations
Posted: Thu Dec 14, 2006 12:36 pm
feyd | Please use
and that I can then access the session from other files such as :
this is partly working, in that I can return the session_id, but I get a “Undefined index: count” with the count parameter. what am I doing wrong?
I’d appreciate any help you could give me.
Thanks in advance
Giles
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi all,
I’m working on my first project with sessions, kind of getting stuck on what is probably a simple point. Would you mind correcting me? My understanding is that I can declare the session variables in an include file such asCode: Select all
<?php
if (!isset($_SESSION["count"]))
{
$_SESSION["start"] = time();
$_SESSION["count"] = 1;
$_SESSION["counthistory"] = 1;
$_SESSION["lastpage"] = 100;
}
$_SESSION["count"]++;
?>Code: Select all
<?php
require_once "admin.inc";
session_start();
echo "session_id() is : " . session_id();
echo "</br>";
echo $_SESSION["count"];
?>I’d appreciate any help you could give me.
Thanks in advance
Giles
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]