-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathranking.php
More file actions
executable file
·95 lines (84 loc) · 3.1 KB
/
ranking.php
File metadata and controls
executable file
·95 lines (84 loc) · 3.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
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
<?php
$cadena = " host='localhost' port='5432' dbname='postgres' user='postgres' password='iavm2umr'";
$dbconn = pg_connect($cadena);
echo "$dbconn";
if (!$dbconn) {
echo "An error occurred.\n";
exit;
}
$a = $_POST['tipo'];
$result = pg_query ($dbconn, "
SELECT nom, ratio
FROM menjar
WHERE tipus = '$a'
ORDER BY ratio;
");
$files =0;
$files = pg_num_rows($result);
$x=0;
while ($x < $files) {
pg_result_seek($result, x);
$valor = pg_fetch_row($result);
$x = $x + 1;
echo <<<HTML
<div class="ranking">
<div class="elements_rank">
<div class="contain">
<a class ="$valor[0]" href="#" title="nom"> $valor[0] </a>
<div class="estrelles">
<a href="#" data-value="1" title="Votar con 1 estrellas"> <img id="una" src="gris.png"></a>
<a href="#" data-value="2" title="Votar con 2 estrellas"> <img id="dos" src="gris.png"> </a>
<a href="#" data-value="3" title="Votar con 3 estrellas"> <img id="tres" src="gris.png"></a>
<a href="#" data-value="4" title="Votar con 4 estrellas"> <img id="quatre" src="gris.png"> </a>
<a href="#" data-value="5" title="Votar con 5 estrellas"> <img id="cinc" src="gris.png"> </a>
</div>
</div>
<style>
#una, #dos, #tres, #quatre , #cinc {
height: 30px;
width: 30px;
display: inline-block;
}
a{
color: black;
font-family: "Verdana";
font-weight: bold;
font-size: 16px;
display: inline-block;
text-decoration: none;
}
.ranking{
display: block;
height: 20%;
}
.elements_rank{
display:block;
height: 80%;
width: 80%;
background-color: rgba(0,0,0,.3);
border-style: solid;
border-width: 0px;
border-color: rgba(0,0,0,.1);
border-radius: 10px;
margin: 0 auto;
padding-left: 20px;
}
.estrelles{
display:inline-block;
height: 100%;
margin: 0 auto;
}
.contain{
display: block;
height: 100%;
width: 100%;
margin: auto 0;
}
</style>
<script src="js/animacions.js"> </script>
</div>
</div>
HTML;
}
pg_close($dbconn);
?>