session_register 可以存储超过 1 个值吗?因为在我的查看产品页面中,我可能需要将 session_register 中的值输入到数据库中。
if(!isset($_SESSION['login_school']))
{
header("location: ../enter-icas/");
}
这是登录页面。
$_SESSION['login_school'] = $myschoolcode;
header("location: ../view-products/");
这是用户登录后的产品页面。
目前上面的代码是存储学校代码,我怎样才能让会话也存储我的学校名称?
$myschoolcode = ($_POST['schoolcode']);
$mypassword = ($_POST['password']);
$sql = "SELECT school_id FROM schools_info WHERE SchoolCode = '$myschoolcode' and Password
= '$mypassword'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$active = $row['active'];
$count = mysql_num_rows($result);
// If result matched $myschoolcode and $mypassword, table row must be 1 row
if($count == 1) {
session_register("myschoolcode");
$_SESSION['login_school'] = $myschoolcode;
header("location: ../view-products/");
}