I have the following SQL code in my PHP file. I want to count the number of rows returned and store it in a variable so I can output it on the page.
I've tried a few solutions I found but none of them worked.
$stmt = $con->prepare('SELECT id, owner_id, hs_name, hs_address FROM hotspots WHERE owner_id = ?');
$stmt->bind_param('i', $_SESSION['id']);
$stmt->execute();
$stmt->bind_result($hsid, $ownerid, $hsname, $hsaddress);
while($stmt->fetch()) {
// print results in loop
}
Any help would be much appreciated.