Advertisement
artlaran

Untitled

Jan 10th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <html> <head>
  2. <title>PHP Beispiel</title>
  3.  
  4. <script>
  5.  
  6. </script>
  7.  
  8. <meta http-quiv="refresh" content=1>
  9. </head>
  10.  
  11. <style>
  12.  table{
  13. border-collapse: collapse;
  14. }
  15. </style>
  16.  
  17. <body>
  18.  
  19. <?php
  20.  
  21. echo "<br>";
  22.  
  23. //SQL server cfg
  24. $servername = "localhost";
  25. $username = "root";
  26. $password = "123456789";
  27. $dbname = "EddyDB";
  28.  
  29. $conn=mysqli_connect($servername, $username, $password, $dbname);
  30. if($conn == false){
  31. die("ERROR Could not connect to SQL.".mysqli_connect_error());
  32. }
  33.  
  34. $sql2= "SELECT * FROM Tabelle01";
  35. $result_1 = mysql_query($conn, $sqL2);
  36.  
  37. //IN TABELLE ANZEIGEN
  38. if ($result_1->num_rows >0){
  39.     echo "<b> Status of Sensor 1: </b>";
  40.     echo "<table border=1><tr><th>X1</th><th>X2</th><th>Message</th></tr>";
  41.     //jede Reihe daten ausgeben
  42.     while($row= $result_1->fetch_assoc()){
  43.         echo "<tr><td>".$row["X1"]."</td><td>".$row["X2"]."</td><td>".$row["msg"]."</td></tr>";
  44.     }
  45.     echo "</table>";
  46. } else{
  47.         echo "0 Results";
  48. }
  49.  
  50. ?>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement