php sessions not working
- Started
- Last post
- 6 Responses
- bezul5550
did you start session? do you have session_start();?
- mikotondria30
ah, it's cool.
Yeh, I'd got session_start() at the top and bottom, but I was trying to read the session variable by calling my script from http://domain, not http://www.domain, which is where I had set the script.
Odd, really but now it works and the session persists, just not between http:// and http://www..
- bezul5550
just keep it at the top, dont repeat; check your globals
- mikotondria30
yes, I don't have a clue why I typed 'and bottom' there.
session_start is indeed only at the top, before all else.
Thanks!
- bezul5550
for testing try echo session_id(); - it really helps sometimes :)
- mikotondria30
yeh right - I mean for me, php is something I really hardly have to think about, I just think it and type it so when a little thing like this comes up it really throws me and I have horrific visions of every other backend I've done suddenly not working because all my principle understanding was wrong.
cheers :)