473,769 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1813
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.netwro te:
>
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
2899
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 session_start();
2
1929
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. Namely... I'm working on someone else's code who has used sessions - In their main login page, they do not use session_start() but instead, just write directly to the $_SESSION super global array variable. This seems to work - however on some later...
3
2212
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 client. MySQL works perfectly. I have created and queried databases with no problem. Apachie 2 appears to work with no problem. I can call up web pages in the expected maner.
1
8930
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 code... I never see that explicitly called. Is it supposed to be called from the Global.asa file (still not sure what that is...) Is "session_start" a server-side scripting thing? Or a client-side scripting thing? I'd really appreciate a nice...
8
2232
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 I set them afterwards?
5
2178
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. Create a new C# ASP.NET web application named "demo" and modify Session_Start in Global.asax.cs as follows: protected void Session_Start(Object sender, EventArgs e) { Response.Write("Session_Start event fired at "+
19
7928
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 limiter - headers already sent in /home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php on line 14
1
1268
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 login/set session/redirect. on the live server, it works fine. on my local computer, it doesn't. in the login script, the session is being created correctly, as print_r() shows me. but when it redirects to the next page, I get "Undefined...
3
1428
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 comment out that first <system_error( $message);>, then the first time through happens without a problem, and the second time through message "jqz cbig93" gets printed to the screen as an error message. At the same time I'm using variable <$hitsto...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.