-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopis2.php
154 lines (126 loc) · 5.97 KB
/
popis2.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
<?php
error_reporting(E_ERROR);
require 'sesija.class.php';
Sesija::kreirajSesiju();
?>
<!DOCTYPE html>
<html lang="hr">
<head>
<title>Dizajn</title>
<link rel="stylesheet" type="text/css" href="css/vgoles.css">
<!-- link za navigation icon -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="author" content="Viktor Goleš">
<meta name="title" content="Dizajn">
<meta name="description" content="Zadaca 1, 17.3.2021.">
<meta name="keywords" content="FOI, HTML, CSS, Dizajn">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="jquery/dataTables.js"></script>
<style>
@media print {
header, footer {
display: none;
}
}
</style>
</head>
<body id="body">
<header>
<div class="navbar">
<a href="index.php"><img id="logo"
src="materijali/logo.png" alt="logo" class="naslovnica"></a>
<a href="#" class ="naslovnica" id="naslov">
Popis Benzinskih Postaja
</a>
<a href="#meni" class="material-icons"
style="font-size: inherit;">menu</a>
<ul id="meni">
<?php
include 'meni.php';
?>
</ul>
</div>
</header>
<div class="container">
<button onclick="window.print(); return false;">Ispis</button>
<div class="info">
<?php
print "
<table id='tablica'>
<thead>
<tr>
<th>ID pumpe</th>
<th>Naziv Pumpe</th>
<th>ID mjesta</th>
<th>Naziv goriva</th>
<th>Cijena goriva</th>
<th>Status goriva</th>
</tr>
</thead>
<tbody>
";
require 'baza.class.php';
$veza = new Baza();
$veza->spojiDB();
$sql = "SELECT p.idPumpa, p.naziv, m.idMjesto, vrstaGoriva.Naziv, Gorivo.cijena, Gorivo.status from Pumpa p
LEFT JOIN Mjesto m ON p.idPumpa = m.idPumpa
LEFT JOIN Gorivo on m.idMjesto = Gorivo.idMjesto
LEFT JOIN vrstaGoriva on Gorivo.idvrstaGoriva = vrstaGoriva.idVrste";
$odg = $veza->selectDB($sql);
while ($red = $odg->fetch_assoc()) {
print "<tr>";
print "<td>" . $red['idPumpa'] . "</td>";
print "<td>" . $red['naziv'] . "</td>";
print "<td>" . $red['idMjesto'] . "</td>";
print "<td>" . $red['Naziv'] . "</td>";
print "<td>" . $red['cijena'] . " HRK</td>";
print "<td>" . $red['status'] . "</td>";
print "</tr>";
}
echo "</table>";
?>
</div>
</div>
<div class="forma">
<form name="gorivo" id="forma" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="id">ID Pumpe</label>
<input id="id" class="txtBox" name="id" type="number" placeholder="Unesite ID pumpe koju Želite pretražiti"/><br>
<?php
$id = $_GET['id'];
$sql2 = "SELECT p.idPumpa, p.naziv, m.idMjesto, vrstaGoriva.Naziv, Gorivo.cijena, Gorivo.status from Pumpa p
LEFT JOIN Mjesto m ON p.idPumpa = m.idPumpa
LEFT JOIN Gorivo on m.idMjesto = Gorivo.idMjesto
LEFT JOIN vrstaGoriva on Gorivo.idvrstaGoriva = vrstaGoriva.idVrste WHERE p.idPumpa = '$id'";
$odg2 = $veza->selectDB($sql2);
echo "<ul style='list-style: none; float: left; text-align: left; color: white;'>";
while ($red2 = $odg2->fetch_assoc()) {
echo "<li>" . $red2['naziv'] . ', ' . $red2['idMjesto'] . ', ' .$red2['Naziv'] . ', ' . $red2['cijena'] . ', ' . $red2['status'];
}
echo "</ul>";
?>
</form>
<input name="submit" class="gumb" type="submit" value="Pretraži" form="forma"/><br>
</div>
<footer>
<div class="validator">
<a href="https://validator.w3.org/nu/?doc=http%3A%2F%2Fbarka.foi.hr%2FWebDiP%2F2021%2Fzadaca_01%2Fvgoles%2Fpopis.php#textarea">
<img alt="HTML5 logo" src="https://barka.foi.hr/WebDiP/2021/materijali/zadace/HTML5.png" width="50" />
</a>
</div>
<p id="copyright">© 2021
<a href="mailto:viktor.goles@gmail.com" class="author">
Viktor Goleš
</a>
</p>
<div class="validator">
<a href="https://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fbarka.foi.hr%2FWebDiP%2F2021%2Fzadaca_01%2Fvgoles%2Findex.php&profile=css3svg&usermedium=all&warning=1&vextwarning=&lang=en">
<img alt="CSS3 logo" src="http://barka.foi.hr/WebDiP/2021/materijali/zadace/CSS3.png" width="56" />
</a>
</div>
</footer>
</body>
</html>