I want to load my data from database using _session in php, but it's not working properly. I don't know also if my code have a problem.
My problem is cannot fetch the data base on the session.
PHP:
<?php
$aid=$_SESSION['u_id'];
$ret="SELECT * FROM tbl_student WHERE u_id=? ";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$aid);
$stmt->execute() ;
$res=$stmt->get_result();
while($row=$res->fetch_object())
{
?>
<tr>
<td style="min-width: 200px;" class="text-center"><?php echo $row->student_name;?></td>
<td style="min-width: 200px;" class="text-center"><?php echo $row->contact_num;?></td>
<td style="min-width: 200px;" class="text-center"><?php echo $row->address;?></td>
?>
</td>
</tr>
<?php }?>
My problem is cannot fetch the data base on the session.