$threads = $db->query_read_slave("SELECT thread.threadid, thread.title, post.pagetext FROM " . TABLE_PREFIX . "thread, post ORDER BY thread.dateline, post.dateline DESC LIMIT 10"); while ($thread = $db->fetch_array($threads)) { $threadcache[] = $thread; } if (!empty($threadcache)) { foreach ($threadcache AS $thread) { echo $thread['threadid']; echo $thread['title']; echo vbdate($vbulletin->options['timeformat'], $thread['dateline']); } }