Re: very basic: session_start();
On Sat, 14 Jun 2008 18:56:59 +0200, Twayne <nobody@devnull.spamcop.net>
wrote:
> If there are better places for basic questions like this, feel free to
> redirect me.
>
> Say I have a php page with session_start(); I can assign variables and
> those variables will carry over to other pages in order to use them in
> those other pages, right? e.g. fname and thus $fname.
No, not $fname, $_SESSION['fname'].
> Let's also
> assume I am not assigning Global variables within any of the code.
Doesn't matter.
> But, if by chance one of those 'other' pages ALSO begins with a
> session_start();
_every_ page that uses a session has to call session_start() (before any
output) to be able to use the $_SESSION array.
> does that close the first session and throw away its
> variables, making them no longer available from 'other' pages?
Nope, it continues the session.
> Is the above what the line $_SESSION['views']=n; is intended to
> accomodate?
> session_start();
> $_SESSION['views']=1;
It just sets a variable in the session array.
> Does that then allow me, from any page, to call whichever set of
> variables I want/need for that particular page by retrieving a 'views'
> set?
You can only retrieve what you have set in the $_SESSION array. What do
you mean with a 'views set'?
--
Rik Wasmus
....spamrun finished
|