<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" c>
<meta name="viewport" c initial-scale=1.0">
<title>Ranking</title>
</head>
<body>
<h1>Average Opinions for Each Station</h1>
<?php
$conn = mysqli_connect("localhost", "root", "", "stacjenarciarskie");
if ($conn) {
// Fetch the average opinion for each station
$result = $conn->query("SELECT id_stacji, AVG(opinia) AS avg_opinion FROM opinie GROUP BY id_stacji");
if ($result->num_rows > 0) {
echo "<table border='1'>";
echo "<tr><th>Station ID</th><th>Average Opinion</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row['id_stacji'] . "</td><td>" . round($row['avg_opinion'], 2) . "</td></tr>";
}
echo "</table>";
} else {
echo "<p>No opinions found for any stations.</p>";
}
mysqli_close($conn);
} else {
echo "Connection failed: " . mysqli_connect_error();
}
?>
</body>
</html>
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}