-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
56 lines (53 loc) · 2.09 KB
/
Copy pathindex.php
File metadata and controls
56 lines (53 loc) · 2.09 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
49
50
51
52
53
54
55
56
<!-- This file is part of smsvote.
opensmsvote is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
opensmsvote is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with opensmsvote. If not, see <http://www.gnu.org/licenses/>.-->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<?php
require_once 'config/include.php';
$event = $_REQUEST[event];
$list = "SELECT eventID FROM event WHERE identity = '".$event."'";
$result2 = mysql_query($list);
$row2 = mysql_fetch_array($result2);
$eventID = $row2[eventID];
$query = "SELECT name, people, teamID FROM team WHERE eventID = ".$eventID;
$query3 = "SELECT teamID FROM votes WHERE eventID = ".$eventID;
$list2 = mysql_query($query);
$vote = mysql_query($query3);
$total = mysql_num_rows($vote);
echo '<br>';
echo '<table class="table">
<tr>
<th>Låt</th>
<th>Uppförd av</th>
<th>Antal röster</th>
<th>Andel av rösterna</th>
<th></th>
</tr>';
while($row = mysql_fetch_array($list2))
{
$query2 = "SELECT ID FROM votes WHERE eventID = '".$eventID."' AND teamID = '".$row['teamID']."' ";
$result = mysql_query($query2);
$num_rows = mysql_num_rows($result);
$percent = ($num_rows/$total)*100;
$percent = number_format($percent, '2');
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['people'] . "</td>";
echo "<td>" . $num_rows . "</td>";
echo "<td>" . $percent . "%</td>";
echo "<td><meter min='0' max='100' value='".$percent."'></td>";
echo "</tr>";
}
echo "<tr><td colspan=4>Totalt ";
echo $total;
echo " röster";
echo "</table>";
?>