I have the below page. The database contains an accounts table, and a hotspots table. The hotspots table has multiple records in it, tied bo the unique user ID of the accounts table - so there may be more than 1 result if the user has more than 1 hotspot. What I want to do is loop through the results and output the name (or any other details) from the database. I've tried a few things, but not been able to get it to work.
Here is my code:
<?php
include 'header.php';
// Get Hotspots for user from DB
$stmt = $con->prepare('SELECT id, owner_id, hs_name, hs_address FROM hotspots WHERE id = ?');
// In this case we can use the account ID to get the hotspot info.
$stmt->bind_param('i', $_SESSION['id']);
$stmt->execute();
$stmt->bind_result($hsid, $ownerid, $hsname, $hsaddress);
$stmt->fetch();
$stmt->close();
?> <div class="content">
<p <p class="block">Welcome back, <?=$_SESSION['name']?>!</p>
<table>
<tr>
<td>Hotspot Name</td>
</tr>
<tr>
<td><?=$hsname?></td>
</tr>
</table>
</div>
</body>
</html>