Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Make a MySQL Connection
- mysql_connect("localhost", "root", "vigyan12#") or die(mysql_error());
- mysql_select_db("TestDb") or die(mysql_error());
- // Get all the data from the "example" table
- $result = mysql_query("SELECT * FROM Datavalues")
- or die(mysql_error());
- echo "<table border='1' align='center' valign='bottom' width='800'>";
- echo "<tr> <th>Time</th> <th>Temperature(Celsius)</th> <th>Humidity(%)</th> </tr>";
- // keeps getting the next row until there are no more to get
- while($row = mysql_fetch_array( $result )) {
- // Print out the contents of each row into a table
- echo "<tr><td align='center'>";
- echo $row['Time'];
- echo "</td><td align='center'>";
- echo $row['Temperature'];
- echo "</td><td align='center'>";
- echo $row['Humidity'];
- echo "</td></tr>";
- }
- echo "</table>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement