-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
39 lines (36 loc) · 940 Bytes
/
test.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
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>测试</title>
</head>
<body>
<?php
header("Content-type: text/html; charset=utf-8");
include_once("database.php");
getConnection();
mysql_query("SET NAMES UTF8");
$query=mysql_query("select * from user");
while($row=mysql_fetch_assoc($query)){
$rows[]=$row;//接受结果集
}
closeConnection();
//遍历数组
echo "<table>";
foreach($rows as $key=>$v){
if($v['user_group']==0){
$user_group = "管理员";
}elseif($v['user_group']==1){
$user_group = "普通用户";
}
echo "<tr>";
//echo $v['user_id']."---".$v['username']."---".$v['password']."---".$v['user_group']."<br>";
echo "<td>".$v['user_id']."</td><td>".$v['username']."</td><td>".$user_group."</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>