Advertisement
Guest User

Untitled

a guest
May 14th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Humidity and Temperature sensor</title>
  5. </head>
  6. <body>
  7.  
  8. <?php
  9. $servername = "localhost";
  10. $username = "id1669689_rahimre";
  11. $password = "Topgun123";
  12. $database = "id1669689_osman";
  13.  
  14. // Create connection
  15. $conn = new mysqli($servername, $username, $password,$database);
  16.  
  17.  
  18. // Check connection
  19. if ($conn->connect_error) {
  20. echo "Connection failed: ";
  21. }else {
  22. echo "Connection success: ";
  23. }
  24.  
  25. $sql = "SELECT id, text FROM temp limit 1";
  26. $result = $conn->query($sql);
  27.  
  28. if ($result->num_rows > 0) {
  29. while($row = $result->fetch_assoc()) {
  30. echo $row["id"];
  31. }
  32. }
  33. //echo "Connected successfully";
  34. $conn->close();
  35. ?>
  36.  
  37.  
  38. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement