Hi im kinda new in php may i ask why i didnt show any records from my database i hope someone can help me how to show the records of my database in html page i double check everything cant still find the error how can i fix this? heres my source code of my work
<table class="table">
<thead>
<tr>
<th class="font-weight-bold">No</th>
<th class="font-weight-bold">Branch</th>
<th class="font-weight-bold">Shift</th>
<th class="font-weight-bold">Nationality</th>
<th class="font-weight-bold">Classification</th>
<th class="font-weight-bold">Local Male</th>
<th class="font-weight-bold">Local Female</th>
<th class="font-weight-bold">Foreign Male</th>
<th class="font-weight-bold">Foreign Female</th>
<th class="font-weight-bold">Admissin Date</th>
<th class="font-weight-bold">Status</th>
<th class="font-weight-bold">Action</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_GET['pageno'])) {
$pageno = $_GET['pageno'];
} else {
$pageno = 1;
}
// Formula for pagination
$no_of_records_per_page = 15;
$offset = ($pageno-1) * $no_of_records_per_page;
$ret = "SELECT ID FROM tblstudent";
$query1 = $dbh -> prepare($ret);
$query1->execute();
$results1=$query1->fetchAll(PDO::FETCH_OBJ);
$total_rows=$query1->rowCount();
$total_pages = ceil($total_rows / $no_of_records_per_page);
$sql="SELECT
tblstudent.StuID,tblstudent.ID as sid,
tblstudent.Branch,
tblstudent.Shift,
tblstudent.Nationality,
tblstudent.Classification,
tblstudent.LocalMale,
tblstudent.LocalFemale,
tblstudent.ForeignMale,
tblstudent.ForeignFemale,
tblstudent.DateofAdmission,
tblstudent.Status
LIMIT $offset, $no_of_records_per_page";
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $row)
{
?>
<tr>
<td><?php echo htmlentities($cnt);?></td>
<td><?php echo htmlentities($row->Branch);?></td>
<td><?php echo htmlentities($row->Shift);?></td>
<td><?php echo htmlentities($row->Nationality);?></td>
<td><?php echo htmlentities($row->Classification);?></td>
<td><?php echo htmlentities($row->LocalMale);?></td>
<td><?php echo htmlentities($row->LocalFemale);?></td>
<td><?php echo htmlentities($row->ForeignMale);?></td>
<td><?php echo htmlentities($row->ForeignFemale);?></td>
<td><?php echo htmlentities($row->DateofAdmission);?></td>
<td><?php echo htmlentities($row->Status);?></td>
<td>
<a href="edit-student-detail.php?editid=<?php echo htmlentities ($row->sid);?>" class="btn btn-primary btn-sm"><i class="icon-eye"></i></a>
<a href="manage-students.php?delid=<?php echo ($row->sid);?>" onclick="return confirm('Do you really want to Delete ?');" class="btn btn-danger btn-sm"> <i class="icon-trash"></i></a>
</td>
</tr><?php $cnt=$cnt+1;}} ?>
</tbody>
</table>
</div>
<div align="left">
<ul class="pagination" >
<li><a href="?pageno=1"><strong>First></strong></a></li>
<li class="<?php if($pageno <= 1){ echo 'disabled'; } ?>">
<a href="<?php if($pageno <= 1){ echo '#'; } else { echo "?pageno=".($pageno - 1); } ?>"><strong style="padding-left: 10px">Prev></strong></a>
</li>
<li class="<?php if($pageno >= $total_pages){ echo 'disabled'; } ?>">
<a href="<?php if($pageno >= $total_pages){ echo '#'; } else { echo "?pageno=".($pageno + 1); } ?>"><strong style="padding-left: 10px">Next></strong></a>
</li>
<li><a href="?pageno=<?php echo $total_pages; ?>"><strong style="padding-left: 10px">Last</strong></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
I hope someone can help me with this much appriciated