Advertisement
sanpai

Website

Apr 4th, 2014
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2. // Make a MySQL Connection
  3. mysql_connect("localhost", "root", "vigyan12#") or die(mysql_error());
  4. mysql_select_db("TestDb") or die(mysql_error());
  5.  
  6. // Get all the data from the "example" table
  7. $result = mysql_query("SELECT * FROM Datavalues")
  8. or die(mysql_error());
  9.  
  10. echo "<table border='1' align='center' valign='bottom' width='800'>";
  11. echo "<tr> <th>Time</th> <th>Temperature(Celsius)</th> <th>Humidity(%)</th> </tr>";
  12. // keeps getting the next row until there are no more to get
  13. while($row = mysql_fetch_array( $result )) {
  14. // Print out the contents of each row into a table
  15. echo "<tr><td align='center'>";
  16. echo $row['Time'];
  17. echo "</td><td align='center'>";
  18. echo $row['Temperature'];
  19. echo "</td><td align='center'>";
  20. echo $row['Humidity'];
  21. echo "</td></tr>";
  22. }
  23.  
  24. echo "</table>";
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement