会话未通过,活动会话就是它得到的 [英] Session not passed and active session is what it gets
问题描述
我想就我的会话问题寻求帮助.:) 有一个我用于大部分页面的活动会话是 $_SESSION['result'] = $result;
然后当这个会话处于活动状态时,我尝试通过另一个会话,但它仍然检索上述会话.
一切从这里开始
<div><p class="editedp"><a href="timekeepingquery.php">计时日志</a></p>
这是我尝试通过的会话,而另一个会话仍处于活动状态
timekeepingquery.php
现在这是我如何检索上述会话.
timekeepinglogs.php
这是我得到的错误
未定义索引:C:\xampp\htdocs\final\timekeepinglogs.php 中的第 3 行
非常感谢所有答案.
你忘记了 timekeepingquery.php 顶部的 session_start();
I would like to ask for assistance with regards to my session problem. :) There's an active session which I used for most of the page which is $_SESSION['result'] = $result;
And then while this one is active I tried to pass another session but it still retrieves the session stated above.
Here where it all started
<?php
session_start();
$loginuser = $_SESSION['result'];
?>
<div>
<p class="editedp"><a href="timekeepingquery.php">Time Keeping Logs</a></p>
</div>
Here's the session I'm trying to pass while another session is still active
timekeepingquery.php
<?php
$con=mysqli_connect("localhost","root","","leavecalendar");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = mysqli_query($con,"SELECT * FROM timekeeping ");
while($row = mysqli_fetch_array($sql))
if(!empty($row)){
$_SESSION['line'] = $row;
header("location:timekeepinglogs.php");
}
?>
Now here is how I retrieve the session stated above.
timekeepinglogs.php
<?php
session_start();
$dataline = $_SESSION['line']; <-------this is where it says error
?>
This is the error I'm getting
Undefined index: line in C:\xampp\htdocs\final\timekeepinglogs.php on line 3
All answers are highly appreciated.
You forgot session_start();
at the top of timekeepingquery.php
这篇关于会话未通过,活动会话就是它得到的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!