Session variables

This is a discussion on "Session variables" within the PHP Forum section. This forum, and the thread "Session variables are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 3rd, 2006, 05:51
New Member
Join Date: Feb 2006
Age: 41
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote

  #2 (permalink)  
Old Feb 3rd, 2006, 22:24
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #3 (permalink)  
Old Feb 7th, 2006, 08:04
New Member
Join Date: Feb 2006
Age: 41
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
Reply

Tags
session, variables

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 Forum 5 Jan 17th, 2008 05:05
Flash and PHP Session Variables saxy46 Flash & Multimedia Forum 0 Jan 27th, 2007 18:21
Session Variables.... courtjester Classic ASP 11 Jul 6th, 2004 00:04
Session Variables ekendricks Classic ASP 4 Dec 19th, 2003 06:33
Session Variables ekendricks Classic ASP 7 Aug 26th, 2003 10:42


All times are GMT. The time now is 07:33.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43