WampServer
Apache, PHP, MySQL on Windows
Home forum
Back to WampServer
presentation
Downloads
Addons
Trainings
Alter Way
Go to Topic:
Previous
•
Next
Go to:
Forum List
•
Message List
•
New Topic
•
Search
•
Log In
•
Print View
$_SESSION problem with WAMP5 1.6.4a!
Posted by:
mongtay
(---)
Date: July 21, 2006 05:01AM
I've just installed WAMP5 with all default settings, but i can't using $_SESSION variable.
Here's my two code pages:
change.php:
//Begin code
<?php
if (!isset($_SESSION['count']))
{
session_start();
$_SESSION['count']=0;
print $_SESSION['count'];
print "<a href=delete.php>delete</a>";
}
else
{
session_start();
$_SESSION['count']++;
print $_SESSION['count']++;
print "<a href=delete.php>delete</a>";
}
?>
//End code
delete.php
//Begin code
<?php
if (!isset($_SESSION['count']))
{
session_start();
$_SESSION['count']=0;
print $_SESSION['count'];
print "<a href=change.php>Change</a>";
}
else
{
session_start();
$_SESSION['count']++;
print $_SESSION['count']++;
print "<a href=change.php>Change</a>";
}
?>
//End code
But, it seem does nothing when i refresh these pages nor clicking on the links (all results are only 0). Can anyone help me?
Thank your advice!
Options:
Reply
•
Quote
Re: $_SESSION problem with WAMP5 1.6.4a!
Posted by:
k776
(---.bliink.ihug.co.nz)
Date: July 21, 2006 10:56AM
Thats becaus session start must be befor eeverything. Try these:
change.php:
//Begin code
<?php
session_start();
if (!isset($_SESSION['count']))
{
$_SESSION['count'] = 0;
print $_SESSION['count'];
print "<a href=delete.php>delete</a>";
}
else
{
$_SESSION['count']++;
print $_SESSION['count']++;
print "<a href=delete.php>delete</a>";
}
?>
//End code
delete.php
//Begin code
<?php
session_start();
if (!isset($_SESSION['count']))
{
$_SESSION['count'] = 0;
print $_SESSION['count'];
print "<a href=change.php>Change</a>";
}
else
{
$_SESSION['count']++;
print $_SESSION['count']++;
print "<a href=change.php>Change</a>";
}
?>
//End code
Options:
Reply
•
Quote
Re: $_SESSION problem with WAMP5 1.6.4a!
Posted by:
mongtay
(---)
Date: July 21, 2006 11:46AM
Thank you so much! It helps!
Options:
Reply
•
Quote
Go to:
Forum List
•
Message List
•
Search
•
Log In
Sorry, only registered users may post in this forum.
Click here to login