1. Does php session change from page to page
In asp, the sessionid doesnot change across pages until logged off or the browser is closed, wot about php?
2. Do i have to use session_start() at every page? why do I have to do this?
3. If I use session_start() to inititate a session then isnot possible to access session id using session_id();?
4. I am developing a shopping cart, if a session id keeps changing then how can I store information about the cart in the db and I prefer storing cart information in db.
Help with sessions
Moderator: General Moderators
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
Re: Help with sessions
1. Nope, they stay the same, like ASP, until the browser gets closed.raghavan20 wrote:1. Does php session change from page to page
In asp, the sessionid doesnot change across pages until logged off or the browser is closed, <span style='color:blue' title='ignorance is bliss'>what</span> about php?
2. Do i have to use session_start() at every page? why do I have to do this?
3. If I use session_start() to inititate a session then isnot possible to access session id using session_id();?
4. I am developing a shopping cart, if a session id keeps changing then how can I store information about the cart in the db and I prefer storing cart information in db.
2. Any page you want the session information to be used on will always require session_start() at the top.
3. erm... someone else will have to answer that.
4. The session ID will stay the same until the user closes the browser.
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
Well you have to obviously tell the page that you want the sessional information to be started. So adding session_start() at the top of everypage seems pretty fine IMO.raghavan20 wrote:thanks for your reply mate.
but I dont understand why they wanted to use session_start() everytime when i wanted to access the sessionid using session_id()