SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old January 23rd, 2003, 04:29 AM
fox66 fox66 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 7 fox66 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
using session vars with PHP

Hi
I am doing some php stuff which will need session vars to be set to remain active during the whole session across all pages in the application. Question:
Do I have to put session_start(); on every page that will need to set, read or create session vars?
Also is it best to use session_register(); or $_SESSION[]?
I have started by using $_SESSION, as I am told this is better?
What then is the method for reading or changing these vars once created?
Sorry, a lot of questions!
Thanks, any help appreciated!

Reply With Quote
  #2  
Old January 23rd, 2003, 07:14 AM
Jeb. Jeb. is offline
"l33t? What's l33t?"
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 51 Jeb. User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to Jeb.
fox66,

You must always perform a call to session_start() at the beginning of every page where you need to access the session variables. Otherwise, you won't be able to use them!

As for the session_register vs $_SESSION, use the $_SESSION autoglobal. It gives you greater functionality than session_register.

When you want to work with the variables, simply modify, add, read or delete them within the $_SESSION array. Manipulate the array just like you would any other.

-Jeb.
__________________
Jeb.

AIM: JebediahMc - PM Me - E-Mail Me


Reply With Quote
  #3  
Old January 23rd, 2003, 11:57 AM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Personally fox, I agree with Jeb.. adding or removing items from the $_SESSION array is much easier than registering or unregistering session variables... I'm lazy.. so it works for me

Reply With Quote
  #4  
Old January 24th, 2003, 03:10 AM
fox66 fox66 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 7 fox66 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
many thanks, $_SESSION it is!
Cheers

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > using session vars with PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway