PHP Sessions Video Tutorials – Part 3

This is part 3 (of 3) of my video tutorials that introduces PHP sessions to beginners.

php sessions video tutorial

The video:

PHP session video tutorial – part 3

Notes from the videos:

Session ID:

PHP sessions create a unique id that is passed on to the user by either a cookie or in the URL string. To be clear, the actual information tracked about the user is stored on the server, the cookie or URL string only contains the unique id that is automatically generated by the PHP session object.


How long do sessions last?

By default, sessions are set to last 24 minutes – although your hosting company could set this to any length of time they want. Once a session expires, the server deletes all information associated with that session. Sessions are kept active by the user hitting pages that have session enabled.

Remember that sessions are not meant as a long term storage solution, that is what databases are for.


Sessions are arrays:

Sessions are auto global associative arrays (on steroids) that can be accessed on any session enabled page. This is yet another example of why knowing arrays is so important in PHP … and in programming in general.

Sessions have to be declared at the very top of the PHP page!

To use session in a PHP page, it needs to be declared at the very top of the page, before anything else, otherwise you will get an error.

If any of the above points confuse you, all you need to do is watch the videos and it will all magically become clear.

:)

The video:

PHP session video tutorial – part 3

Thanks,

Stefan Mischook

www.killerphp.com


This entry was posted on Sunday, February 17th, 2008 at 7:46 pm and is filed under Beginners PHP Articles, PHP Videos. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

2 Responses to “PHP Sessions Video Tutorials – Part 3”

  1. Eric Kadlec says:

    Do you accept guest posts? I like the way how you wrote
    PHP Sessions Video Tutorials – Part 3 – KillerPHP.com Blog , I am in this topic for ages and I would adore to write two or three articles here in case you agree with me.

  2. Stefan Mischook says:

    We do sometimes, just send me an email (stefan at killerphp.com) and I will take a look.

    Stefan

Created By Stefan Mischook  |  Top of page  go to top of page