LPH
Well-known member
Since I'm to the point of actually getting beyond connecting to the XF database ... now it's time to do something with it.
Besides the php.net manual, is there a good resource on while statements?
I'm stuck on the echo statement in the code below. The code only returns 1 result instead of 10. (HEY! At least I got this far).
Thanks for the resource links.
Besides the php.net manual, is there a good resource on while statements?
I'm stuck on the echo statement in the code below. The code only returns 1 result instead of 10. (HEY! At least I got this far).
Code:
$db = XenForo_Application::getDb();
if (!$db) {
die('This script did not connect to the database' . mysql_error());
}
$threads_qry = $db->query("
SELECT *
FROM `xf_thread`
ORDER BY `last_post_date` DESC
LIMIT 10
");
while ($thread = $threads_qry->fetch()) {
$latestthreads[$thread['thread_id']] = array(
'id' => $thread['thread_id'],
'title' => $thread['title'],
'url' => XenForo_Link::buildPublicLink('canonical:threads', $thread),
'replycount' => $thread['reply_count'],
'dateline' => $thread['post_date']
);
echo ("<a href='" . XenForo_Link::buildPublicLink('canonical:threads', $thread) . "' >" . $thread['title'] . "</a><br />"); // Echo the title with a link. This returns ONE. Now what? LOL
// echo "These are the latest threads" . . "<br />And now there should be ten.";
}
Thanks for the resource links.