Hello, I am trying to stop the data in the following table from continuing to repeat itself, as in looping on the same data, crashing the browser:
Here's the query:
$posts = mysqli_fetch_assoc(mysqli_query($db, "SELECT * from tbl_bugresponse WHERE bugid = $id ORDER BY time"));
And here's the table code:
<table width="100%" class="tborder"><tr>
<th class="tcat">Name</th>
<th class="tcat">Reply</th>
</tr>
<?php
$colour="1";
while($posts){
if($colour=="1"){
echo ("<tr class='alt1'>");
$f1=$posts['by'];
$f2=$posts['content'];
$colour="2";
} else {
echo "<tr class='alt2'>";
$f1=$posts['by'];
$f2=$posts['content'];
$colour="1";
}
?>
<td><?php echo $f1; ?></td>
<td><?php echo $f2; ?></td>
</tr>
<?}?>
</table>
Note that I am using mysqli not mysql.