I am trying to output all the rows of the result of a database query but my while loop keeps repeating only the first row multiple times. It repeats only the first row the total number of times of expected outcome. Please I need help.
$sql = "SELECT * FROM review WHERE lid = '".$_GET['id']."'";
$result = $conn -> query($sql);
$row = $result -> fetch_assoc();
if (mysqli_num_rows($result) == 0){
echo "<div class='no-comment'>No Comments found!</div>
<button class='btn btn-default btn-lg center-block' data-toggle='modal' data-target='#Review'>Review Lecturer Now!</button>
";
}else{
while($result -> fetch_assoc()){
echo"
<div class='comment'>
<div class='reviewer-name'>".$row['rid']."<span class='review-date'>".$row['reviewDate']."</span><hr>
<p>".$row['review']."</p></div>
</div>
";
}
}