Based on this answer : https://stackoverflow.com/a/14671645/3696490
I have the following php code to get all rows from a database, and print them
<?php
//$con =mysqli_connect (...) ; // my DB info here
$stmt = $con->prepare('SELECT id, username, email FROM accounts');
$stmt->execute();
$stmt->bind_result($id, $user, $email,$isadmin);
while ($stmt->fetch()) {
echo "
<tr>
<td>$user</td>
<td>$email</td>
<td>$id</td>
</tr>";
}
$stmt->close();
This code works perfectly, but I was checking more examples today and I noticed in tutorials they always use stmt->get_result()
Can someone please explain how/why the above code works fine without get/store ?
Thanks