iwa-panda1

Manage Weather Data by International Weather Agency (Version 1)
Log | Files | Refs

commit ccc4be78817dd6267ad0fc59e903ec42f4933312
Author: Gerco van Woudenbergh <[email protected]>
Date:   Mon, 20 Mar 2023 15:30:41 +0100

mockdata request

Diffstat:
Aweerdata.css | 9+++++++++
Aweerdata.php | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/weerdata.css b/weerdata.css @@ -0,0 +1,8 @@ +table { + border-collapse: collapse; + } + + table, th, td { + border: 1px solid black; + } + +\ No newline at end of file diff --git a/weerdata.php b/weerdata.php @@ -0,0 +1,64 @@ +<?php +$servername = "86.92.67.21"; +$username = "friedel"; +$password = "koffiemetzuiker"; +$dbname = "wap2"; + +// Create connection +$conn = mysqli_connect($servername, $username, $password, $dbname); +// Check connection +if (!$conn) { + die("Connection failed: " . mysqli_connect_error()); +} + +$sql = "SELECT * FROM weerdata"; +$result = mysqli_query($conn, $sql); + +if (mysqli_num_rows($result) > 0) { + // output data of each row + echo" + <head> <link rel=\"stylesheet\" type=\"text/css\" href=\"weerdata.css\"> </head> + <table>" . + " <tr> + <th> data id </th> + <th> station naam </th> + <th> datum & tijd </th> + <th> gevalideerd </th> + <th> temp </th> + <th> dauwpunt </th> + <th> luchtdruk zeeniveau </th> + <th> luchtdruk stationniveau </th> + <th> zichtbaarheid </th> + <th> windsnelheid </th> + <th> neerslag </th> + <th> sneeuwdiepte </th> + <th> gebeurtenissen </th> + <th> bewolking </th> + <th> windrichting </th> + </tr>"; + while($row = mysqli_fetch_assoc($result)) { + echo"<tr>" . + "<td>" . $row["data_id"]. "</td>" . + "<td>" . $row["station_name"] . "</td>" . + "<td>" . $row["datum_tijd"]. "</td>" . + "<td>" . $row["gevalideerd"]. "</td>" . + "<td>" . $row["temp"]. "</td>" . + "<td>" . $row["dauwpunt"]. "</td>" . + "<td>" . $row["ldrk_znv"]. "</td>" . + "<td>" . $row["ldrk_station"]. "</td>" . + "<td>" . $row["zichtbaarheid"]. "</td>" . + "<td>" . $row["windsnelheid"]. "</td>" . + "<td>" . $row["neerslag"]. "</td>" . + "<td>" . $row["sneeuwdpt"]. "</td>" . + "<td>" . $row["gebeurtenissen"]. "</td>" . + "<td>" . $row["bewolking"]. "</td>" . + "<td>" . $row["windrichting"]. "</td>" . + "</tr>"; + } + echo"</table>"; +} else { + echo "0 results"; +} + +mysqli_close($conn); +?> +\ No newline at end of file