-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput.php
More file actions
48 lines (48 loc) · 1.1 KB
/
output.php
File metadata and controls
48 lines (48 loc) · 1.1 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Table with database</title>
<style>
table {
border-collapse: collapse;
width: 100%;
color: #588c7e;
font-family: monospace;
font-size: 25px;
text-align: left;
}
th {
background-color: #588c7e;
color: white;
}
tr:nth-child(even) {background-color: #f2f2f2}
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>RollNo</th>
<th>AvgMP</th>
<th>AvgAAMM</th>
<th>AvgTCS</th>
<th>AvgDBMS</th>
<th>AvgCN</th>
</tr>
<?php
$conn = mysqli_connect("localhost", "root", "", "db");
// Check connection
$qtest="SELECT * FROM tbl_excel ORDER BY rollno";
$data0=mysqli_query($conn,$qtest);
while ($row0 = mysqli_fetch_assoc($data0)) {
$avgmp=(((int)$row0['mp1']+(int)$row0['mp2'])/2);
$avgaamm=(((int)$row0['aamm1']+(int)$row0['aamm2'])/2);
$avgtcs=(((int)$row0['tcs1']+(int)$row0['tcs2'])/2);
$avgdbms=(((int)$row0['dbms1']+(int)$row0['dbms2'])/2);
$avgcn=(((int)$row0['cn1']+(int)$row0['cn2'])/2);
echo "<tr><th>".$row0["name"]."</th><th>".$row0['rollno']."</th><th>".$avgmp."</th><th>".$avgaamm."</th><th>".$avgtcs."</th><th>".$avgdbms."</th><th>".$avgcn;
}
?>
</table>
</body>
</html>