-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreview.php
81 lines (77 loc) · 2.61 KB
/
preview.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html>
<head>
<title>Vertical table</title>
<link rel="stylesheet" type="text/css" href="css/table-column-options.css" />
</head>
<body id="printarea">
<table class="column-options">
<thead>
<tr>
<?php
include 'Data/connect.php';
$result = $conn->query("select * from absen");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
if ($result->num_rows > 0) {
if ($row = $result->fetch_assoc()) {
// print_r($row);
echo "<tr>";
for($i = 0; $i < count($row); $i++ )
{
$keys = array_keys($row);
echo "<th>$keys[$i]</th>";
}
echo '</tr>';
}
}
echo '</head><tbody>';
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr class=\"odd\">";
for($i = 0; $i < count($row); $i++ )
{
$keys = array_values($row);
echo "<td>$keys[$i]</th>";
}
echo '</tr>';
}
}
echo "</body>";
?>
</table>
<?php
$result = $conn->query("SELECT * from absen");
if ($result->num_rows > 0) {
if ($row = $result->fetch_assoc()) {
echo count($row);
$rowcount=mysqli_num_rows($result);
echo "$rowcount";
}
}
?>
</body>
</html>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
/*border: 1px solid #dddddd;*/
text-align: center;
padding: 8px;
}
/*tr:nth-child(even) {
background-color: #dddddd;
}*/
</style>
<style type="text/css">
table { page-break-inside:auto }
tr { page-break-inside:avoid; page-break-after:auto }
thead { display:table-header-group }
tfoot { display:table-footer-group }
</style>