Thanks for your help.
This is my query so far:
$query = "SELECT * FROM vb_post WHERE visible = 1 ORDER BY postid DESC LIMIT 0, 10";
IF I change it to this:
$query = "SELECT * FROM vb_post, vb_thread WHERE visible = 1 AND vb_post.threadid = vb_thread.threadid AND vb_thread.forumid <> 4 ORDER BY postid DESC LIMIT 0, 10";
I get the error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/thesno/public_html/getnews.php on line 22
--------------- Added [DATE]1226769124[/DATE] at [TIME]1226769124[/TIME] ---------------
I did it! Not the best way do to it I'm sure would be grateful if someone could show a better way but this works:
PHP Code:
$query = "SELECT * FROM vb_post WHERE visible = 1 ORDER BY postid DESC LIMIT 0, 10";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$sql = "SELECT forumid FROM vb_thread WHERE threadid = '$row[threadid]' LIMIT 0, 10";
$theresult = mysql_query($sql);
while ($data = mysql_fetch_array($theresult, MYSQL_ASSOC)) {
if ($data[forumid] != 4) {
$text = substr($row[pagetext], 0, 20);
echo '<strong><a href="http://www.fmstyle.co.uk/member.php?u='.$row[userid].'">'.$row[username].'</a></strong>';
echo '<p>'.$text.'... [[';
echo '<a href="http://www.fmstyle.co.uk/showthread.php?t='.$row[threadid].'">Go to Thread</a>';
echo ']]</p>';
}
}
}