session unset not working properly
Posted: Thu Aug 26, 2004 2:01 am
I have a system where a report is created in 4 steps.
page 1 stablishes some session vars, page 2 some more and so on..
page 4 commits data to database and unsets all report-related session vars like so
etc, etc
The reason for having session vars is so that users can navigate back and forth between pages without having them to re-enter all data.
The thing is, after users get to page 4 and unset the vars, when they come back to page 1 to do ANOTHER different report, the session data is still there
in my report pages I am doing somthing like this:
(one_query is my function for getting one row from db)
This should create a number larger than the largest report number in db. This works fine first time in session, but when generating report after unsetting the sessions in page 4, the generated ID from the first report is still my number for the second report.
Any help or rants are much appreciated
page 1 stablishes some session vars, page 2 some more and so on..
page 4 commits data to database and unsets all report-related session vars like so
Code: Select all
unset($_SESSION['report_var_1']);
unset($_SESSION['report_var_2']);The reason for having session vars is so that users can navigate back and forth between pages without having them to re-enter all data.
The thing is, after users get to page 4 and unset the vars, when they come back to page 1 to do ANOTHER different report, the session data is still there
in my report pages I am doing somthing like this:
Code: Select all
// report number generator routine
if (!(isset($_SESSION['RID_in'])))
{
$sql = "SELECT * from tblreport SORT BY RID DESC;";
$row = one_query($sql);
$_SESSION['RID_in'] = $row['RID'] + rand(0,50) + 1;
}
echo "Creating report ".$_SESSION['RID_in'];This should create a number larger than the largest report number in db. This works fine first time in session, but when generating report after unsetting the sessions in page 4, the generated ID from the first report is still my number for the second report.
Any help or rants are much appreciated