473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Re: very basic: session_start();

using session_start() on a script - if there is no session it sets
one up; if there is a session, it opens it. If you wait too long
between pages it disposes the session automatically (set time for
session to keep alive in php.ini).

You need session_start() on all pages that needs to access the
$_SESSION array.

$_SESSION is just like an array variable, so if you want to segregate
data you could set a sub array of page data in $_SESSION...

$_SESSION['views'][1] = ...array of data...;

Hope that helps
Larry
Jun 27 '08 #1
2 1776
using session_start() on a script - if there is no session it sets
one up; if there is a session, it opens it. If you wait too long
between pages it disposes the session automatically (set time for
session to keep alive in php.ini).
Ha! I think that might explain a couple of "strange" events that happen
when I go away and come back later! If I read that right, it's only
about 24 minutes (1440 S). I'm not going to change it because I don't
know the nuances/inter-plays of the php.ini yet. I'm perfectly happy
just knowing there's a reason for it! I've been getting ready to blame
the OS.
>
You need session_start() on all pages that needs to access the
$_SESSION array.

$_SESSION is just like an array variable, so if you want to segregate
data you could set a sub array of page data in $_SESSION...

$_SESSION['views'][1] = ...array of data...;

Hope that helps
Larry
I think I'm starting to catch on; for whatever reason I've been totally
misinterpreting some of these things including $_SESSION. It's always
hardest for me to get the basics into my head when I start something new
like this.

Thanks much

Twayne
Jun 27 '08 #2
On Jun 14, 11:02 am, "Twayne" <nob...@devnull.spamcop.netwrote:
>
You need session_start() on all pages that needs to access the
$_SESSION array.
$_SESSION is just like an array variable, so if you want to segregate
data you could set a sub array of page data in $_SESSION...
$_SESSION['views'][1] = ...array of data...;
I think I'm starting to catch on; for whatever reason I've been totally
misinterpreting some of these things including $_SESSION. It's always
hardest for me to get the basics into my head when I start something new
like this.
Sometimes it's a lot more simpler then you realize.

How to use arrays is a big part of making some cool PHP stuff,
especially how to handle them in form data and in $_SESSION. It's
taken me a while to wrap my brain around it too, but its worth it.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Florence HENRY | last post by:
Hello, I've searched about my problem on google before posting, but I didn't find anything relevant... I have a problem with session_start. Here is my code : <html> <head> <?php...
2
by: Reply-Via-Newsgroup Thanks | last post by:
Folks, I consider myself a reasonably strong PHP programmer, but I've not used sessions before (I've used cookies instead) and I'd appreciate it if someone could confirm something for me. ...
3
by: Trogdor | last post by:
I set up a server on an AMD 650 machine running gentoo linux. I installed Apachie 2, MySQL 4.1 and PHP 4.3.11 I use another computer on my local net (192.168.0.x) to access the server as a...
1
by: Mercy | last post by:
Hi, I'm a newbie. I was trying to figure out how to use the Session_start method? The reference books I'm reading say that a session STARTS when "session_start" is called. But ... in their sample...
8
by: lkrubner | last post by:
I was trying to set a cookie before I called session_start() and it was giving me an error. But isn't sessions really just a cookie? Why would it matter if I sent a cookie before session_start? Can...
5
by: Niklas Uhlin | last post by:
Someone please explain why Session_Start fires multiple times / retains SessionID values between sessions, when you open an ASP.NET page from MS Word. For details of the problem, see below: 1....
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
1
by: Marc E | last post by:
All, I've read the docs on session handling but still can't figure this one out. I'm guessing it's a setting in php.ini or something. I've inherited this code from someone, and it's got a typical...
3
by: kvnsmnsn | last post by:
I've got a piece of PHP code that gets executed twice. The first time through, variable <$Useris unregistered, so message "jqz cbig90" gets printed to the screen as an error message. When I...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.