Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- #data {
- font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
- border-collapse: collapse;
- width: 100%;
- }
- #data td, #customers th {
- border: 1px solid #ddd;
- padding: 8px;
- }
- #data tr:nth-child(even){background-color: #f2f2f2;}
- #data tr:hover {background-color: #ddd;}
- #data th {
- padding-top: 12px;
- padding-bottom: 12px;
- text-align: left;
- background-color: #4CAF50;
- color: white;
- }
- </style>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "sensem";
- $password = "h@";
- $conn = new mysqli($servername, $username, $password);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT id, tijd, waarde FROM weerstation.metingen";
- $result = $conn->query($sql);
- echo "<table id=\"data\" style=\"width:100%\"><tr><th>Tijd</th><th>Temperatuur (Celcius)</th></tr>";
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<tr><td>".$row["tijd"]."</td><td>".$row["waarde"]."</td></tr>";
- }
- } else {
- echo "0 resultaten";
- }
- echo "</table>";
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement