02-12-23, 12:29 PM
السلام عليكم
لماذا في كود تالي عندما اضغط علي زر لا يعرض بيانات في باقي صفحات
لماذا في كود تالي عندما اضغط علي زر لا يعرض بيانات في باقي صفحات
PHP كود :
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>الرئيسية</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<script src="./js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<table class="table my-5 table-bordered border-primary">
<thead>
<tr>
<th class="text-center " scope="col">#</th>
<th class="text-center" scope="col"> رقم القيد</th>
<th class="text-center" scope="col">اسم الطالب</th>
<th class="text-center" scope="col"> اسم المقرر</th>
<th class="text-center" scope="col">رمز المقرر </th>
<th class="text-center" scope="col"> النصفي الاول</th>
<th class="text-center" scope="col"> نصفي الثاني</th>
<th class="text-center" scope="col">النهائي </th>
<th class="text-center" scope="col">عمليات </th>
</tr>
</thead>
<tbody>
<?php
include 'database.php';
include 'navbar.php';
$sql="select *from student";
$resault=mysqli_query($conn,$sql);
$num=mysqli_num_rows($resault);
$numberpages=2;
$totalpages=ceil($num/$numberpages);
for($btn=1;$btn<=$totalpages;$btn++)
{
echo '<button class="btn btn-dark mx-1 my-3"> <a href="pagination.php?page='.$btn.'" class="text-light"> '.$btn.'</a> </button>';
}
if(isset($_GET['page']))
{
$page=$_GET['page'];
}
else{
$page=1;
}
$startinglimit=($page-1)*$numberpages;
$sql="select *from student LIMIT ".$startinglimit.','.$numberpages;
$resault=mysqli_query($conn,$sql);
while($row=mysqli_fetch_array($resault))
{
$id=$row['id'];
echo '<tr>
<td class="text-center"> '.$row['id'].' </td>
<td class="text-center"> '.$row['id_code'].' </td>
<td class="text-center"> '.$row['fname'].' </td>
<td class="text-center"> '.$row['course_name'].' </td>
<td class="text-center"> '.$row['course_code'].' </td>
<td class="text-center"> '.$row['mid_exam'].' </td>
<td class="text-center"> '.$row['fir_exam'].' </td>
<td class="text-center"> '.$row['final'].' </td>
<td class="text-center"> <button class="btn btn-primary "> <a href="update.php?updateid='.$id.'" class="text-light"> تعديل</a> </button>
<button class="btn btn-danger "> <a href="delete.php?deleteid='.$id.'" class="text-light">حدف </a> </button> </td>
</tr>';
}
?>
</tbody>
</table>
</div>
</body>
</html>