-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
92 lines (85 loc) · 3.74 KB
/
index.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
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quản Lý Sinh Viên TH23.21</title>
<link href="img/student.ico" rel="icon" type="image/ico" />
<link type="text/css" rel="stylesheet" href="./css/reset.css">
<link type="text/css" rel="stylesheet" href="./css/style.css">
</head>
<body>
<?php
$active = array("","","","","","");
$active[0] = "active";
include_once "main/header.php";
?>
<main>
<div class="wrapper-index">
<?php
if(isset($_SESSION['username'])){
include_once "./database/database.php";
?>
<h3>Thống kê</h3>
<div class="outter-box-index" >
<div class="inner-box a" id="1">
<p class="box-title">Số Sinh Viên</p>
<?php
$sql = "SELECT count(*) as C FROM students";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)) echo 'SQL error';
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
?>
<p class="box-content"><?php echo $row['C'];?></p>
</div>
<div class="inner-box b" id="2">
<p class="box-title">Số lớp</p>
<?php
$sql = "SELECT count(*) as C FROM classes";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)) echo 'SQL error';
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
?>
<p class="box-content"><?php echo $row['C'];?></p>
</div>
<div class="inner-box c" id="3">
<p class="box-title">Số ngành</p>
<?php
$sql = "SELECT count(*) as C FROM majors";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)) echo 'SQL error';
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
?>
<p class="box-content"><?php echo $row['C'];?></p>
</div>
<div class="inner-box d" id="4">
<p class="box-title">Điểm</p>
<?php
$sql = "SELECT count(*) as C FROM transcripts";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)) echo 'SQL error';
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
?>
<p class="box-content"><?php echo $row['C'];?></p>
</div>
</div>
<?php
mysqli_stmt_close($stmt);
}else{
?>
<p class="noti">Đăng Nhập để xem thông tin</p>
</div>
</main>
<?php
}
include_once "main/footer.php";
?>
</body>
</html>