weerdata.php (2008B)
1 <?php 2 $servername = "86.92.67.21"; 3 $username = "friedel"; 4 $password = "hailiwa"; 5 $dbname = "wap2"; 6 7 // Create connection 8 $conn = mysqli_connect($servername, $username, $password, $dbname); 9 // Check connection 10 if (!$conn) { 11 die("Connection failed: " . mysqli_connect_error()); 12 } 13 14 $sql = "SELECT * FROM weerdata"; 15 $result = mysqli_query($conn, $sql); 16 17 if (mysqli_num_rows($result) > 0) { 18 // output data of each row 19 echo" 20 <head> <link rel=\"stylesheet\" type=\"text/css\" href=\"weerdata.css\"> </head> 21 <table>" . 22 " <tr> 23 <th> data id </th> 24 <th> station naam </th> 25 <th> datum & tijd </th> 26 <th> gevalideerd </th> 27 <th> temp </th> 28 <th> dauwpunt </th> 29 <th> luchtdruk zeeniveau </th> 30 <th> luchtdruk stationniveau </th> 31 <th> zichtbaarheid </th> 32 <th> windsnelheid </th> 33 <th> neerslag </th> 34 <th> sneeuwdiepte </th> 35 <th> gebeurtenissen </th> 36 <th> bewolking </th> 37 <th> windrichting </th> 38 </tr>"; 39 while($row = mysqli_fetch_assoc($result)) { 40 echo"<tr>" . 41 "<td>" . $row["data_id"]. "</td>" . 42 "<td>" . $row["station_name"] . "</td>" . 43 "<td>" . $row["datum_tijd"]. "</td>" . 44 "<td>" . $row["gevalideerd"]. "</td>" . 45 "<td>" . $row["temp"]. "</td>" . 46 "<td>" . $row["dauwpunt"]. "</td>" . 47 "<td>" . $row["ldrk_znv"]. "</td>" . 48 "<td>" . $row["ldrk_station"]. "</td>" . 49 "<td>" . $row["zichtbaarheid"]. "</td>" . 50 "<td>" . $row["windsnelheid"]. "</td>" . 51 "<td>" . $row["neerslag"]. "</td>" . 52 "<td>" . $row["sneeuwdpt"]. "</td>" . 53 "<td>" . $row["gebeurtenissen"]. "</td>" . 54 "<td>" . $row["bewolking"]. "</td>" . 55 "<td>" . $row["windrichting"]. "</td>" . 56 "</tr>"; 57 } 58 echo"</table>"; 59 } else { 60 echo "0 results"; 61 } 62 63 mysqli_close($conn); 64 ?>