PDA

View Full Version : Having trouble with News system


wackyjoe
04-10-2006, 04:01 AM
Hi there,

Im trying to create a news system from vB...i have created a forum Called News on my forum...and in trying to get all of the fields to display as latest news on my sites home page this is my code so far but nothing is showing up:


<?

$DB->query("SELECT p.*, t.*, t.title,
p.username AS username,
t.replycount, t.forumid, t.threadid AS threadid,
p.threadid, p.pagetext FROM
thread AS t
LEFT JOIN post AS p ON (t.threadid=p.threadid)
AND t.forumid = '1'
ORDER BY t.threadid
LIMIT 5
") or die(mysql_error());
while($r = $DB->fetch_array()) {
echo "
Title: ". $r['title'] ." <br />
Author: ". $r['username'] ."<br />
<br />
News: ". $r['pagetext'] ."
<p>
<a href=\"cubicforum/showthread.php?t=" . $r['threadid'] ."\">
Comments (" .$r['replycount'] .") </a>
</p>
";
}

?>


any help wud be appreciated