Sayfayı sunarken i oturumu oluşturma. Bundan sonra ben AJAX sayfa her 4 saniyede arıyorum. AJAX sayfa Session bilgileri gettign değildir.
Bunun nedeni ne olabilir. Ajax istekleri Session bilgilerini korumak Yüklü olsun?
Kod:
Normal HTML
<body onload="timerint(11)">
<div style="display:none;">
<button id="prev"><<</button>
<button id="next">>></button>
</div>
<div class="anyClass">
<ul id="news-ul">
<?php
include('render_latest.php');
?>
</ul>
</div>
</body>
render_latest.php
<?php
session_start();
$con = mysql_connect("localhost","root","root");
mysql_select_db("test_db", $con);
$i=1;
$lastresult=mysql_query("SELECT MAX(epoch) as latestepoch FROM list_data");
while($row = mysql_fetch_array($lastresult))
{
//$_session['lastepoch'] = $row['latestepoch'] ;
$_session['lastepoch']=12345;
}
$result=mysql_query("SELECT * FROM list_data order by epoch desc LIMIT 4 ");
while($row = mysql_fetch_array($result))
{
echo '<li>';
echo $row['list_item'] . '<br/>' ;
echo $row['epoch'] . '<br/>';
echo $_session['lastepoch'];
echo '</li>';
}
?>
AJAX Page
<?php
session_start();
$t=$_SESSION['lastepoch'];
$con = mysql_connect("localhost","root","root");
mysql_select_db("test_db", $con);
$result=mysql_query("SELECT * FROM list_data order by epoch desc LIMIT 1 ");
while($row = mysql_fetch_array($result))
{
echo '<li>';
echo $t;
echo $row['list_item'] ;
echo '</li>';
}
?>