I have a problem using session. I set the session variables in the previous page, then when I use those variables at the next page, there is nothing in the variable. The following is the code that I wrote.
First Page:
Code: Select all
<?php
if (!isset($_SESSION['position']))
{ $_SESSION['position'] = "curr";}
if (!isset($_SESSION['clientid']))
{$_SESSION['clientid'] = "1";}
?>
Code: Select all
$db_name = "poll";
$table_name = "cinfo";
$connection = @mysql_connect("localhost", "p", "111") or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
SWITCH ($_SESSION['position'])
{ CASE "curr":
$result = @mysql_query("SELECT clientid FROM $table_name WHERE clientid = $_SESSION['clientid'] ORDER BY serno");
break;
CASE "next":
break;
CASE "prev":
break;
CASE "first":
break;
CASE "last":
break;
}
?>
this intention and why the contents of the session variables don't move to next page. And as I know, the line
$result = @mysql_query("SELECT clientid FROM $table_name WHERE clientid = $_SESSION['clientid'] ORDER BY serno"); has a parsing error. Thank you for your help in advance.