-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.php
34 lines (34 loc) · 897 Bytes
/
list.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
<link rel="stylesheet" href="list.css">
<?php
echo '最近登入資料:</br>';
require_once 'connect.php';
$form = "SELECT `username`,`logintime` FROM `qwer` ORDER BY `logintime` DESC LIMIT 10";
$result = mysqli_query($connect, $form);
$answer = array();
if ($result) {
if (mysqli_num_rows($result) > 0) {
while ($a = mysqli_fetch_assoc($result)) {
$answer[] = $a;
}
}
mysqli_free_result($result);
}
?>
<table style="width:100%;">
<tr>
<th>No.</th>
<th>user</th>
<th>logintime</th>
</tr>
<?php
foreach ($answer as $value => $a) :
echo '<tr>';
echo '<td>' . ($value + 1) . '</td>';
?>
<td><a href="hi.php?id=<?php echo $a['username']; ?>"><?php echo $a['username']; ?></a></td>
<?php
echo '<td>' . $a['logintime'] . '</td>';
echo '</tr>';
endforeach;
?>
</table>