|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-12-18 13:40 UTC] eetimle at tpu dot fi
First here's the whole script:
<?php
session_start();
if(!session_is_registered('ind'))
{
$ind = 0;
session_register('ind');
$table[$ind] = 1;
session_register("table");
}
else
{
$ind = $_SESSION['ind'];
//Lis?t??n alkio tauluun
$table[$ind] = 1;
session_register("table");
}
//increases the index
$ind++;
$_SESSION['ind'] = $ind;
$i= 0 ;
//prints all the data in $table
while ($i < $ind)
{
print("$table[$i]<br>");
$i++;
}
?>
I have tested this script both Linux(script works perfectly) and Win98SE(doesn't work). Both have Apache and PHP 4.2.3.
So I'm using session cookie $table where to store number 1 in each index. Index increases every time i press refresh. Script should print (after three refresh):
1
1
1
1
But with my Windows scripts prints (after three refresh):
Notice: Undefined offset: 0 in c:\www\sessio_taulu_testi.php on line 32
Notice: Undefined offset: 1 in c:\www\sessio_taulu_testi.php on line 32
Notice: Undefined offset: 2 in c:\www\sessio_taulu_testi.php on line 32
1
When entering the script for the first time scripts prints correctly:
1
I have deleted the session file after each time I've executed the script, so that shouldn't be the problem.
I would like to know what's the problem in here :)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 02:00:01 2025 UTC |
Here's the script that works both Linux&Win98SE session_start(); if(!session_is_registered('ind')) { $ind = 0; session_register('ind'); session_register("table[$ind]"); $_SESSION["table[$ind]"] = 1; } else { $ind = $_SESSION['ind']; //Lis?t??n alkio tauluun session_register("table[$ind]"); $_SESSION["table[$ind]"] = 1; } //increases the index $ind++; $_SESSION['ind'] = $ind; $i= 0 ; //prints all the data in $table while ($i < $ind) { print($_SESSION["table[$i]"] . "<br>"); $i++; }