Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "shhhhhhhhhhhhhh";
  5. $dbname = "databaseName";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. $sql = "SELECT id, time, so2, o2, voc FROM tableName";
  15. $result = $conn->query($sql);
  16.  
  17. if ($result->num_rows > 0) {
  18. // output data of each row
  19. while($row = $result->fetch_assoc()) {
  20. //Echo the data you need here in the form (for me) [time, so2, o2, voc], (don't forget the comma) and then echo a "\n" character.Basically what you're echoing into the html will be something like this:
  21.  
  22. //[timestamp, 23, 43, 12],
  23. //[timestamp, 25, 41, 18],
  24. //etc...
  25. }
  26. } else {
  27. echo "0 results";
  28. }
  29.  
  30. $conn->close();
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement