Is it possible to do something like we do in normal mysqli queries in prepared statements in while lopping. For example
$sql = "SELECT * FROM users"*;
$query = mysqli_query($link, $sql);
while($row = mysqli_fetch_assoc($query)){
echo $row['username'];
echo $row['name'];
}
In prepared statements, it goes like this
$fetch_comments = $friend_zone->prepare("SELECT item_poster, comment FROM status_comments WHERE status_id = ? and item_poster = ?");
$fetch_comments->bind_param("is", $status__id, $item_poster);
$fetch_comments->execute();
$fetch_comments->store_result();
$fetch_comments->bind_result($item_poster_fetched, $comment_fetched);
while($fetch_comments->fetch(){
echo $item_poster;
}
What i mean is i want to do the echo like so
echo $row['something'];
The solution i came up with now is to fetch them using bind result, then put them into an array inside the loop and then foo['bar'];
or something of that sort.
Is there a better way?