I tidied it up a bit and fixed it *hope*.
Your queries are confusing so just shout back if i created an error lol.
<?php
include("admin/config.php");
$db = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname) or die('Cannot connect to database'.mysql_eror());
$CQuery = @mysql_query("SELECT * FROM `reply`") or die(mysql_error());
$comments= mysql_num_rows($CQuery);
$Query = @mysql_query("SELECT * FROM `qlitenews` ORDER BY id $news_format LIMIT $news_limit") or die(mysql_error());
echo "<table>";
while ( $r = mysql_fetch_array($Query) )
{
echo "
<tr><td><span style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; color: $head_color; font-weight: bold;\">$r[title]</span></td></tr>
<tr><td><span style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; color: $body_color\">$r[news]</span></td></tr>\n";
if ($news_info == 1)
{
echo "<tr><td>
<div style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; color: $info_color; border-top: 1px dashed $border_color; text-align: left;\">
<a href=\"news/view_comments.php?id=".$r['id']."\">Comments ($comments)</a> /
<a href=\"news/post_comment.php?id=".$r['id']."\">Post Comment</a>
</div>
<div style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; color: $info_color; text-align: right;\">
Posted by $r[author] / $r[date]
</div>
</td></tr>\n";
}
}
echo "</table>\n";
?>
Try and use single quites and '.$row['bla'].' instead of escaping with
\" btw
I havent done that in the modified code though, its up to you if you want it that way
btw: On your comments query, you are selecting
all of the comments you know? not just comments relating to that article. You need to put it within the while loop and use a WHERE to make it select comments only for the showing article.
Edited by .Matt, 04 June 2006 - 01:05 PM.