<!-- Place select results in a data table -->
<table summary="users table" border="1">
<caption>Users Table</caption>

<thead>
<tr>
<th scope="col">User Id</th>
<th scope="col">Login</th>
<th scope="col">Password</th>
<th scope="col">E-mail</th>
</tr>
</thead>

<tbody>

<?php
//Connect to the database
$db = sqlite_open("day23.sqlite");
if (!$db)
   die(sqlite_error_string(sqlite_last_error($db)));

//Create the SQL query string to get the table data
$sql = "SELECT * FROM users";

//Run the SQL query
$result = sqlite_query($sql, $db);
if (!$result)
   die(sqlite_error_string(sqlite_last_error($db)));

// Display the results in a table, row by row
while ($row = sqlite_fetch_array($result)){
   print("<tr>\n" .
         "<td>" . $row["id"]       . "</td>\n" .
         "<td>" . $row["login"]    . "</td>\n" .
         "<td>" . $row["password"] . "</td>\n" .
         "<td>" . $row["email"]    . "</td>\n" .
         "</tr>\n");
}
// Close the database connection
sqlite_close($db);
?>

</tbody>
</table>