php sessions

  • bretlee123
  • Born
  • Born
  • bretlee123
  • Posts: 3

Post 3+ Months Ago

I am working on sessions now in php and i am totally lost on what i have to do is their anyone that can explain it in easy steps for me because i just do not get it.


Thanks
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Nightslyr
  • Proficient
  • Proficient
  • Nightslyr
  • Posts: 283

Post 3+ Months Ago

bretlee123 wrote:
I am working on sessions now in php and i am totally lost on what i have to do is their anyone that can explain it in easy steps for me because i just do not get it.


Thanks


That's a bit of a loaded question.

Essentially, you simply need to write:

Code: [ Select ]
session_start();


At the beginning of each script file that you want to be able to access session info. From there, it's as simple as using the session superglobal array to actually use the session itself:

Code: [ Select ]
$_SESSION['user'] = 'Bubba';
echo $_SESSION['user']; //<-- will output Bubba
  1. $_SESSION['user'] = 'Bubba';
  2. echo $_SESSION['user']; //<-- will output Bubba


More info here: http://www.php.net/manual/en/book.session.php
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8409
  • Loc: USA

Post 3+ Months Ago

There is an advanced tutorial on sessions written by may. Check that out and see if you understand anything.

But if you want a simple how-to on setting and printing session variables, then Nightslyr basically gave you what you need.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: Liamw411 and 39 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.