this code unsets $_SESSION['editor'] but doesn't touch any other session variables
| From: | anders thoresson | Date: | Sun, 07 Sep 2003 17:35:47 +0000 |
| Subject: | this code unsets $_SESSION['editor'] but doesn't touch any other session variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-161916@lists.php.net to get a copy of this message | ||
Hi,
I've had troubles with an application that randomly (until now) unsets the session variable $_SESSION['editor']. I've hunted through all my code and finally managed to rule out everything else than the following couple of lines.
It unsets the session variable $_SESSION['editor'], but leaving others, like $_SESSION['admin'] untouched. At the first debug, I get "Admin: Y Editor: Y" printed (which is the way I suppose things to be), but at the second debug I just get "Admin: Y Editor:".
I can't find the error though. Any input appreciated!
Best regards,
Anders Thoresson
<?php
// Debug, echoing session variables
echo ("Admin: " );
echo ($_SESSION['admin']);
echo (" Editor: " );
echo ($_SESSION['editor']);
$issuequery = "SELECT un_issue.i_date, un_issue.i_editor FROM un_issue WHERE un_issue.i_date > CURDATE() ORDER BY i_date ASC";
$issueresult = mysql_query($issuequery);
$editorquery = "SELECT u_uname, u_id FROM un_user WHERE u_editor = 'Y'";
$editorresult = mysql_query($editorquery);
?>
<form action="issue_save_changes.php" method="post">
<table cellspacing="0">
<?php
// Initate counter for table background
$background = 1;
// Loop through all coming issues
while ($issue = mysql_fetch_row($issueresult))
{
mysql_data_seek($editorresult, 0);
if (is_even($background))
{
$row_background = "even";
}
else
{
$row_background = "odd";
}
?>
<tr class="<?php echo $row_background; ?>">
<td class="borderless"><input name="issue[]" type="hidden" value="<?php echo $issue[0]; ?>"> <?php echo format_date($issue[0]); ?></td>
<td class="borderless"><select name="issue_editor[]">
<?php
// If editor isn't entered, highlight "Inte bestämt"
if (!isset($issue[1]))
{
?>
<option value=NULL selected>Inte bestämt
<?php
while ($editor = mysql_fetch_row($editorresult))
{
?>
<option value="<?php echo $editor[1] ?>"><?php echo $editor[0]; ?>
<?php
}
} // If an editor is entered, highlight her/him
else
{
?>
<option value=NULL>Inte bestämt
<?php
while ($editor = mysql_fetch_row($editorresult))
{
if ($editor[1] == $issue[1])
{
?>
<option value="<?php echo $editor[1] ?>" selected><?php echo $editor[0]; ?>
<?php
}
else
{
?>
<option value="<?php echo $editor[1] ?>"><?php echo $editor[0]; ?>
<?php
}
}
}
?>
</select>
</tr>
<?php
++$background;
}
?>
</table>
<input type="submit" value="Spara ändringar">
</form>
<?php
// Debug, echoing session variables
echo ("Admin: " );
echo ($_SESSION['admin']);
echo (" Editor: " );
echo ($_SESSION['editor']);
--
anders thoresson