I noticed a couple of days ago that 2 of my scripts weren't working that heavily rely on sessions. I did some debugging by creating another session variable assigning it with the value 1 and then increment it by 1 on each visit. That seemed to work fine and then my other scripts started working again. I thought problem solved until the same thing happened last night and as soon as I created another session variable with the value 1 and incremented it once, the other scripts started working again. Now the same thing has happened now but I haven't assigned a value to my test session variable because I was hoping someone has come across this problem before and can run some diagnostics with me to solve the problem.
I can post code of my 2 scripts that aren't working but they're a couple of hundred lines long and I don't want to spam the board. If you need to see them though let me know.
Regards,
Session values not being stored.
Moderator: General Moderators
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
The only thing that comes to mind is that you're not calling session_start() before your output starts (session_start() adds headers), and that by assigning a $_SESSION variable you're implicitly calling it early enough.
Try moving session_start() to the very first line in your script, maybe by using auto_prepend_file.
Cheers,
Kieran
Try moving session_start() to the very first line in your script, maybe by using auto_prepend_file.
Cheers,
Kieran
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
try setting and see if you get warnings when it fails
Cheers,
Kieran
Code: Select all
error_reporting(E_ALL);Cheers,
Kieran
-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
Kieran Huggins wrote:The only thing that comes to mind is that you're not calling session_start() before your output starts (session_start() adds headers), and that by assigning a $_SESSION variable you're implicitly calling it early enough.
Try moving session_start() to the very first line in your script, maybe by using auto_prepend_file.
Cheers,
Kieran
It's taken me a while to solve this problem, and looking back on this post now, Keiran_Huggins had solved the problem and I hadn't noticed
Anyway, you were correct. I had 1 line before it to start a form and then started the session on the second line.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact: