Random spaces appearing?
Posted: Fri May 26, 2006 3:00 pm
Jcart | Please use
Hope someone can help this rather annoying problem..
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi there, Im coding a basic blog type page and what is happening is depending on how many blog entries there are a space is being displayed above the table.
Hence, Welcome to .....'s Blog is being displayed then the amount of random new lines, and then the table starts containing the blog entries. It must be something to do with the while loop because the amount of new lines is relevant to how many posts there are. Everything else appears excatly how it should, e.g. the table with the blog entries.
here is a snippet:Code: Select all
?> <tr>
<td><b>Welcome to <?php echo $name; ?>'s Blog! </b><br/></td>
<td align="right"><img src="<?=$imgurl?>" class="imgborder" /></td>
</tr>
<tr>
<td colspan="2" valign="top">
<!--Main Content
Displaying last
<form>
<select name="nodisp">
<option>10</option>
<option>20</option>
<option>30</option>
<option>All</option>
</select>
</form>
entries:
-->
<?php
$query = "SELECT * from $table";
$result = mysql_query($query);
$i = 0;
while ($row = mysql_fetch_array($result)) {
if($i != 0) {
echo "<tr><td align='center' bgcolor='99CCFF' class='tblhead' style='border-top:solid 1px gray;'><b>".$row[$title]."</b> (".$row[$date].")</td></tr><br>\n";
} else /* first one */ {
echo '<table align="center" class="nametbl" cellspacing="0" width="95%">';
echo "<tr><td align='center' bgcolor='99CCFF' class='tblhead'><b>".$row[$title]."</b> (".$row[$date].")</td></tr><br>\n";
}
echo "<tr><td class='blog'>".$row[$body]."</td></tr>";
if($row[$imgsrc] != "")
{
echo "<tr><td class='blog'><img src=\"$row[$imgsrc]\" alt=\"$row[$imgsrc]\"></td></tr>";
}
echo "<td><tr> </tr></td>";
$i++;
}
?>Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]