我試圖從不斷重演,因爲在循環在相同的數據停止下表中的數據,崩潰的瀏覽器:停止連續表生成
這裏的查詢:
$posts = mysqli_fetch_assoc(mysqli_query($db, "SELECT * from tbl_bugresponse WHERE bugid = $id ORDER BY time"));
這裏的表代碼:
<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>
請注意,我使用mysqli不是mysql。
我會如何把該代碼? – bear 2009-06-08 21:29:12