hey guys, I know this isn't my thread, but I actually wanted to do this same thing on my site, but can't seem to pull it off without warnings. And, when I take out the warnings, it's still not pulling any data out, which was pretty obvious after reading the warnings ;-)
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/****/public_html/i/include/functions.php on line 53
I'm using the same code as above:
PHP Code:
$lastpost_titles = array();
$lastpostdata = $db->query_read("
SELECT thread.threadid, thread.title
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post ON(thread.lastpostid = post.postid)
WHERE thread.forumid <> 31
ORDER BY thread.lastpost DESC
LIMIT 4
");
while ($post = $db->fetch_array($lastpostdata))
{
$lastpost_titles[] = '<a href="forums/showthread.php?t=' . $post['threadid'] . '">' . $post['title'] . '</a>';
}
echo implode('<br />', $lastpost_titles);
I've tried a million different things, but still get the same warnings/errors.
Basically, I'm trying to pull the info from the forums onto the front page of my site, which is a static php page.
Any help would be much appreciated!