01.
<?php
02.
require
'dbconnect.php'
;
03.
$show
=
"SELECT * FROM internship"
;
04.
$show_data
= mysqli_query(
$con
,
$show
);
05.
?>
06.
<html>
07.
<head>
08.
<meta charset=
"utf8"
>
09.
<link rel=
"stylesheet"
href=
"css/bootstrap.min.css"
>
10.
11.
<link rel=
"stylesheet"
href=
"css/bootstrap-theme.min.css"
>
12.
<link rel=
"stylesheet"
href=
"css/main.css"
>
13.
</head>
14.
<body>
15.
<center>
16.
<br>
17.
18.
<table border=
"1"
>
19.
<tr>
20.
<th><center>ID</center></th>
21.
<th><center>ชื่อ นามสกุล</center></th>
22.
<th><center>Email</center></th>
23.
24.
<tr>
25.
<?php
26.
$page
= isset(
$_GET
[
'page'
])?
$_GET
[
'page'
]:
''
;
27.
$page
= isset(
$_POST
[
'page'
])?
$_POST
[
'page'
]:
'1'
;
28.
$rows
=3;
29.
30.
if
(
$page
<=0)
31.
$page
=1;
32.
33.
$total_data
=
"SELECT COUNT(id)FROM internship"
;
34.
$query_row
= mysqli_query(
$con
,
$total_data
);
35.
$total
=mysqli_fetch_row(
$query_row
);
36.
$total_data
=
$total
[0];
37.
38.
$total_page
=
ceil
(
$total_data
/
$rows
);
39.
40.
$star
=
$page
*
$rows
;
41.
if
(
$page
>=
$total_page
)
42.
$page
=
$total_page
;
43.
$star
=(
$page
-1)*
$rows
;
44.
45.
$show
=
"SELECT * FROM internship ORDER BY id Asc Limit $star,$rows"
;
46.
$show_data
= mysqli_query(
$con
,
$show
);
47.
?>
48.
49.
<?php
50.
while
(
$employee
= mysqli_fetch_assoc(
$show_data
)){
51.
?>
52.
<tr>
53.
<td> <?php
echo
$employee
[
'id'
];?></td>
54.
<td> <a href=
"showDescription.php?name=<?php echo $employee['name'];?>"
><?php
echo
$employee
[
'name'
];?></a></td>
55.
<td> <?php
echo
$employee
[
'email'
];?></td>
56.
<td> <?php
echo
$employee
[
'university'
];?></td>
57.
<td> <a href=
"update_register.php?id=<?php echo $employee['id'];?>"
>แก้ไข</a></td>
58.
</tr>
59.
<?php
60.
}
61.
?>
62.
<tbody></tbody>
63.
</table>
64.
65.
<center>
66.
<nav aria-label=
"Page navigation example"
>
67.
<ul
class
=
"pagination"
>
68.
<li
class
=
"page-item"
><a
class
=
"page-link"
href=
"#"
>Previous</a></li>
69.
<?php
for
(
$i
=1;
$i
<=
$total_page
;
$i
++) { ?>
70.
71.
<li <?php
if
(
$page
== 1)
echo
'class ="action"'
;?>>
72.
<a
class
=
"page-link"
href=
"Register.php?page=<?php=$i?>"
><?php=
$i
?></a></li>
73.
74.
<?php
75.
}
76.
?>
77.
<li
class
=
"page-item"
><a
class
=
"page-link"
href=
"#"
>Next</a></li>
78.
</ul>
79.
</nav>
80.
</center>
81.
</center>
82.
</body>
83.
</html>