I want to use prepared statement which works fine if it's just one row, but when I want to build a table it only shows the first row. I'm missing something simple somewhere, but I've tried all sorts of things which just broke.
<?php
$dbh = dbh_get();
$sql = 'SELECT * FROM products
WHERE prod_id >6
ORDER BY prod_id';
$stmt = $dbh->prepare($sql);
$stmt->execute();
$r = $stmt->fetch();
print '
<tr>
<td>' . $r['login_id'] . '</td>
<td>' . $r['outlet_code'] . '</td>
<td>' . $r['user_name'] . '</td>
<td>' . $r['user_role'] . '</td>
<td>' . $r['last_login'] . '</td>
<td>' . $r['user_id'] . '</td>
</tr>' . "\n";
dbh_free($dbh);
?>
Unsure if it's the php or the sql which is the problem