473,394 Members | 1,965 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,394 software developers and data experts.

session variable increment problem

session_start();
$_SESSION['visits']++;
print 'You have visited here '.$_SESSION['visits'].' times.';

why the visit variable is not incremented the next time i enter.

Notice: Undefined index: visits in C:\Program Files\Apache
Group\Apache2\htdocs\session\cookie2.php on line 3
You have visited here 1 times.
Jul 16 '05 #1
3 3207
On 10 Aug 2003 06:27:26 -0700, sk***********@hotmail.com (sky2070) wrote:
session_start();
$_SESSION['visits']++;
print 'You have visited here '.$_SESSION['visits'].' times.';

why the visit variable is not incremented the next time i enter.

Notice: Undefined index: visits in C:\Program Files\Apache
Group\Apache2\htdocs\session\cookie2.php on line 3
You have visited here 1 times.


Have you ever set it to zero?

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #2
sky2070 wrote:
session_start();
$_SESSION['visits']++;
print 'You have visited here '.$_SESSION['visits'].' times.';

why the visit variable is not incremented the next time i enter.

Notice: Undefined index: visits in C:\Program Files\Apache
Group\Apache2\htdocs\session\cookie2.php on line 3
You have visited here 1 times. session_start(); if (!array_key_exists('visits', $_SESSION))
{
$_SESSION['visits'] = 0;
} $_SESSION['visits']++;
print 'You have visited here '.$_SESSION['visits'].' times.';

Jul 16 '05 #3
matty <ma*******@askmenoquestions.co.uk> wrote in message news:<6P*****************@wards.force9.net>...
session_start();

if (!array_key_exists('visits', $_SESSION))
{
$_SESSION['visits'] = 0;
}
$_SESSION['visits']++;
print 'You have visited here '.$_SESSION['visits'].' times.';

the script stop at 1 time, why?
Jul 16 '05 #4

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

Similar topics

6
by: -D- | last post by:
I'm trying to accomplish the following. I'm trying to get the values for the table rows that are dynamically created to persist through a redirect. Referring URL:...
4
by: N. Demos | last post by:
Hello, I'm learning ASP.NET, and am having a strange problem with some example code from the book I'm using. The code increments and displays the value stored in a session variable when the "Add"...
1
by: Nathan Sokalski | last post by:
I am trying to increment the Session variable at certain points in my code, but it will not work. The initial value assigned to it is always the one that is displayed. Here is the code used to...
3
by: Aaron | last post by:
Why do my session values return to nothing on post back? I want to click a button and have the row, as in: dataset.table(0).rows(THIS ROW NUMBER IS WHAT I AM TALKING ABOUT), either increment or...
2
by: xisco | last post by:
hi all, I am counting the number of users logged in my website. That's how I do in my global.asax (asp.net 2.0) - in my application_start I initialize an application variable with 0; - in...
1
by: TheAmes | last post by:
Hi VB.net 2.0 website developed with VWD 2005 Express one masterpage one content page aspx and a global.asax in the application startup event of the global.asax file i declare a
2
by: TheAmes | last post by:
Hi VB.net 2.0 website developed with VWD 2005 Express one masterpage one content page aspx and a global.asax
3
by: Goran | last post by:
Hi @ all! Is it possible to overload a member variable? Example: class ClassA_t {
1
by: =?Utf-8?B?S2V2aW4=?= | last post by:
Hi! I've migrated my web App 1.1 to Asp.Net 2.0 using the VS Migration Wizard, I've added 4 pages aps.net 2.0, Ajax Extensions. Everything works ok until yesterday that I've Pubilsh the web...
0
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
My program needs to do X when someone 'starts using' their Windows user account, and it should do Y when they 'stop using' their Windows user account. By 'starts using' I mean they log on, unlock...
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: 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...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.