-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetTableGit.php
More file actions
31 lines (23 loc) · 755 Bytes
/
Copy pathgetTableGit.php
File metadata and controls
31 lines (23 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
//This php script gets the 10 latest entries from a MySQL database. It shows the fields "timestamp" and "name" in a table.
//add your database username, password and database name below
$con=mysqli_connect("localhost","USER NAME","PASSWORD","DATABASE NAME");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM `lamp_Name_List` ORDER BY `ID` DESC LIMIT 0 , 10");
echo "<table border='1'>
<tr>
<th>Tijd</th>
<th>Naam</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['timestamp'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>