Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "shhhhhhhhhhhhhh";
- $dbname = "databaseName";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT id, time, so2, o2, voc FROM tableName";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- //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:
- //[timestamp, 23, 43, 12],
- //[timestamp, 25, 41, 18],
- //etc...
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement