01.
<?php
02.
require
'connectdb.php'
;
03.
require_once
(
'mpdf/mpdf.php'
);
04.
ob_start();
05.
$q
=
"select * from tutor"
;
06.
$result
= mysqli_query(
$con
,
$q
);
07.
?>
08.
<!DOCTYPE html>
09.
<html>
10.
<head>
11.
<meta charset=
"UTF-8"
>
12.
<title>แสดงชื่อติวเตอรื</title>
13.
</head>
14.
<body>
15.
<center><font size=
"24"
><?php
echo
"รายได้ของติวเตอร์"
; ?></font><center>
16.
<center><table border =
"2 "
style =
"width:1000px"
>
17.
<tr>
18.
<th>รหัสติวเตอร์</th>
19.
<th>ชื่อติวเตอร์</th>
20.
<th>จบสูงสุด</th>
21.
<th>ระดับที่สอน</th>
22.
<th>สถานที่สอน</th>
23.
<th>สอนวิชา</th>
24.
<th>ชั่วโมงที่สอน</th>
25.
</tr>
26.
<?php
27.
while
(
$row
= mysqli_fetch_array(
$result
, MYSQLI_ASSOC)) {
28.
?>
29.
<tr>
30.
<td><center><?php
echo
$row
[
'ID_t'
].
"<br>"
;?></center></td>
31.
<td><center><?php
echo
$row
[
'Name_t'
].
"<br>"
;?></center></td>
32.
<td><center><?php
echo
$row
[
'Info_t'
].
"<br>"
;?></center></td>
33.
<td><center><?php
echo
$row
[
'Grade_t'
].
"<br>"
;?></center></td>
34.
<td><center><?php
echo
$row
[
'Local_t'
].
"<br>"
;?></center></td>
35.
<td><center><?php
echo
$row
[
'Main_t'
].
"<br>"
;?></center></td>
36.
<td><center><?php
echo
$row
[
'Limit_t'
].
"<br>"
;?></center></td>
37.
</tr>
38.
<?php }
39.
mysqli_free_result(
$result
);
40.
mysqli_close(
$con
);
41.
?>
42.
</body>
43.
</html>
44.
<?php
45.
$html
= ob_get_contents();
46.
ob_end_clean();
47.
$pdf
=
new
mPDF(
'th'
,
'A4-L'
,
'0'
,
''
);
48.
$pdf
->SetAutoFont();
49.
$pdf
->SetDisplayMode(
'fullpage'
);
50.
$pdf
->WriteHTML(
$html
, 2);
51.
$pdf
->Output(
"MyPDF/MyPDF.pdf"
);
52.
?>
53.
ดาวโหลดรายงานในรูปแบบ PDF <a href=
"MyPDF/MyPDF.pdf"
>คลิกที่นี้</a>