Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > PHP

Reply
 
LinkBack Thread Tools
Old February 3rd, 2006, 01:51 AM   #1
New Member
 

Join Date: Feb 2006
Age: 43
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 ideleon is on a distinguished road
Session variables

Hi, i've run across a problem when i try to
use session variables.

I create a session variable in form1, for example

session_start();
$_SESSION['my_var'] = 100;

Then i should be able to access the above session
variable in any subsequent pages, however,
in some instances i get the error message: "Undefined index 'my_var' in....
I don't call session_destroy() in any of the subsequent scripts.

It's an intermittent problem, if i try to recreate the steps which caused
the error to occur, the error doesn't occur at all.

Has anyone run into this type of problem?

Thanks a lot, any help would be greatly appreciated.
ideleon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 3rd, 2006, 06:24 PM   #2
Reputable Member
 

Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 grahame is a jewel in the rough grahame is a jewel in the rough grahame is a jewel in the rough
Re: Session variables

1. Could your session be timing out?

2. Do you have another PHP based application running on the same server at the same time? If so, your sessions might be getting confused

3. Are you refusing or deleting cookies?

4. Your message is only a warning ... do you sometimes turn warnings off?

Applications can sometimes appear to start in the middle while you're developing them if the session is set and you upload a fresh copy of the PHP page. It will start with $_SESSION in a different state to you would expect, and if you're using hidden fields or some other secondary mechanism as well as the session to maintain state, results can be very offputting.

-- Graham
grahame is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 7th, 2006, 04:04 AM   #3
New Member
 

Join Date: Feb 2006
Age: 43
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 ideleon is on a distinguished road
Re: Session variables

Re: timeouts:
I don't think so. Although i don't have access to php.ini, i assume
it's using the default timeout value of 180mins.

Re: other php scripts:
I'll have to find that one out. But, shouldn't sessions be getting their
own IDs everytime you call session_start() or session_register()?

Re: cookies:
Haven't changed anything in IE but will check this. Other sessions
on other PCs get the same thing though. So i assume nothing
has been changed in the browser settings.

Thanks a lot for the response. Will continue trying to find out the cause.
Am really perplexed.
ideleon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
session , variables


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Problems with Session Variables... JustinStudios PHP 5 January 17th, 2008 01:05 AM
Flash and PHP Session Variables saxy46 Flash and ActionScript 0 January 27th, 2007 02:21 PM
Session Variables.... courtjester Classic ASP 11 July 5th, 2004 08:04 PM
Session Variables ekendricks Classic ASP 4 December 19th, 2003 02:33 AM
Session Variables ekendricks Classic ASP 7 August 26th, 2003 06:42 AM


Search Engine Optimization by vBSEO 3.2.0 RC8