-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathResults.php
160 lines (160 loc) · 4.36 KB
/
Results.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<title>e-ELECTION</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.cards{
background-color:white !important;
text-align: center !important;
width:100% !important;
height:100% !important;
display: inline-block !important;
transition: all .3s ease-in-out !important;
}
#c1{
box-shadow: 0 4px 50px 0 lightblue,0 6px 20px 0 #777;
}
#c2{
box-shadow:0 4px 50px 0 pink,0 6px 20px 0 #777;
}
</style>
</head>
<body>
<?php include('Header.html');?>
<center><h1> Congratulations to all the winners!</h1></center>
<canvas id="canvas" width="50" height="50"></canvas>
<div class="container">
<div class='row'>
<?php
require('connection.php');
if($_POST['button']=="Class Representative")
{
$table="cr";
}
else if($_POST['button']=="Music Incharge")
{
$table="musicincharge";
}
else if($_POST['button']=="Cultural Incharge")
{
$table="culturalincharge";
}
else if($_POST['button']=="SOrt Incharge")
{
$table="sortincharge";
}
else if($_POST['button']=="Sports Incharge")
{
$table="sportincharge";
}
else if($_POST['button']=="Ecell Incharge")
{
$table="ecellincharge";
}
$sql="SELECT MAX(votes) FROM $table where sex='male'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
{
$votes=$row['MAX(votes)'];
}
$sql2 = "select username from $table where votes='$votes'";
$result2 = $conn->query($sql2);
while($row = $result2->fetch_assoc())
{
$email=$row['username'];
}
$sql1 = "SELECT * FROM user where email='$email'";
$result1 = $conn->query($sql1);
if ($result1->num_rows > 0)
{
while($row = $result1->fetch_assoc())
{
echo "
<div class='col-sm-1'></div>
<div class='col-sm-4'>
<div class='cards' id='c1'>
<div class='row'>
<div class='col-sm-12'>
<img class='img-responsive' style='width:100% alt='Image' src='icons/male.jpg'>
</div>
<div class='col-sm-12'>
Name:<b>".$row['firstname']." ".$row['lastname']."</b>
</div>
<div class='col-sm-12'>
Division:<b>".$row['course']." ".$row['divi']."</b>
</div>
<div class='col-sm-12'>
Contact Number:<b>".$row['mobileno']."</b>
</div>
<div class='col-sm-12'>
Email ID:<b>".$row['email']."</b>
</div>
<div class='col-sm-12'>
Votes Received:<b>".$votes."</b>
</div>
</div>
</div>
</div>
";
}
}
?>
<?php
$sql="SELECT MAX(votes) FROM $table where sex='female'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
{
$votes=$row['MAX(votes)'];
}
$sql2 = "select username from $table where votes='$votes'";
$result2 = $conn->query($sql2);
while($row = $result2->fetch_assoc())
{
$email=$row['username'];
}
$sql1 = "SELECT * FROM user where email='$email'";
if ($result1->num_rows > 0)
{
while($row = $result1->fetch_assoc())
{
echo " <div class='col-sm-2'></div>
<div class='col-sm-1'></div>
<div class='col-sm-4'>
<div class='cards' id='c2'>
<div class='row'>
<div class='col-sm-12'>
<img class='img-responsive' style='width:100% alt='Image' src='icons/female.jpg'>
</div>
<div class='col-sm-12'>
Name:<b>".$row['firstname']." ".$row['lastname']."</b>
</div>
<div class='col-sm-12'>
Division:<b>".$row['course']." ".$row['divi']."</b>
</div>
<div class='col-sm-12'>
Contact Number:<b>".$row['mobileno']."</b>
</div>
<div class='col-sm-12'>
Email ID:<b>".$row['email']."</b>
</div>
<div class='col-sm-12'>
Votes Received:<b>".$votes."</b>
</div>
</div>
</div>
</div>
";
}
}
?>
</div>
</div>
<?php include('confetti.html');?>
<?php include('Footer.html');?>
</body>
</html>