This is my code to display some news items from a MySQL Database.
It uses CSS to align the boxes and text, but for some reason the output is continually stacked on top of one another. All of the messages are in the source code when it is finished interpreting but only the last one written to the html is displayed. Not quite sure what the problem is.
If you want to get the full source here are the pages:
PHP:
http://gusmay.tollfreepage.com/index.php
CSS:
http://gusmay.tollfreepage.com/index.css
JS:
http://gusmay.tollfreepage.com/index.js
Code:
<?php
$query = "SELECT * FROM entry ORDER BY entry_id DESC";
$result = @mysql_query($query);
$top = 0;
if ($result){
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "<div class=\"newsblock\" style=\"top:" . $top . ";\">";
echo "<div class=\"newstop\"></div>";
echo "<div class=\"newstopleft\"></div>";
echo "<div class=\"newstopmid\">";
echo $row[1];
echo "</div>";
echo "<div class=\"newstopright\"></div>";
echo "<div class=\"newsmid\"></div>";
echo "<div class=\"newsbottom\"><br/>";
echo $row[2];
echo "</div></div>";
$top = $top + 50;
}
}
?>