output buffering not working within the logic
Posted: Mon Apr 10, 2006 2:19 pm
i have this code
which in my eyes should do 1 loop and then print out the results to the browser, however it will maybe do 1-19 and then print out to the browser, then 20-38 etc.
Why is it doing this?
Code: Select all
$query = "SELECT * FROM rl_links";
$result = mysql_query($query) or die (mysql_error());
?>
<table width="1000" border="0" cellspacing="3" cellpadding="3">
<?
while ($array = mysql_fetch_array($result))
{
if (!isset($i)) {
$i = 1;
}
ob_start ();
echo ' ';
$std = new getURLInformation($array['url']);
$rec = new getURLInformation($array['reciprocal']);
// get colors to display table background
if ($std->validURL === TRUE) {
$tdURLBackground = "green";
} else {
$tdURLBackground = "red";
}
if ($rec->validURL === TRUE) {
$tdRecBackground = "green";
} else {
$tdRecBackground = "red";
}
?>
<tr>
<td class="num" width="74" rowspan="2"><?=$i;?></td>
<td class="content" width="926" style="background-color: <?=$tdURLBackground;?>"><?=$array['url'];?></td>
</tr>
<tr>
<td class="content" style="background-color: <?=$tdRecBackground;?>"><?=$array['reciprocal'];?></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<?
unset($std);
unset($rec);
ob_end_flush();
$i++;
}
?>
</table>
</body>
</html>Why is it doing this?