UseBB Community

UseBB support, discussion and development

How can i put lastest post in UseBB to my html page?

Post Reply

Page: < 1 2

Author Post
Member
Registered: Oct 2005
Posts: 502
Location: Canada
Not a problem :)
Member
Registered: Oct 2007
Posts: 5
One small problem I just found out about now: it doesn't recognize threads by guests. How do I work around that?
Member
Registered: Oct 2005
Posts: 502
Location: Canada
This should work:


<?php



mysql_connect('', '', '');

mysql_select_db('');


$result = mysql_query("SELECT t.id, t.topic_title, t.count_replies, t.count_views, t.status_locked FROM usebb_topics t WHERE t.forum_id = 11 AND t.status_sticky = 0 ORDER BY t.id DESC LIMIT 5");



echo '<ul>';



while ($news = mysql_fetch_array($result)) {



echo '<li><a href="forum/topic.php?id='.$news['id'].'">';

echo htmlspecialchars($news['topic_title']).'</a></li>';



}



echo '</ul>';



?>
Member
Registered: Dec 2007
Posts: 2
I've been screwing with this code for a few hours now and I'm getting the same error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

Is it possible to get an updated version of the code posted or am I not replacing a variable to match my database right?

Thank you
Member
Registered: Oct 2005
Posts: 502
Location: Canada
Paste the code you have please ( excluding your database info ).
Member
Registered: Dec 2007
Posts: 2
<?php



mysql_connect('localhost', ' ', ' ');

mysql_select_db(' ');


$result = mysql_query("SELECT t.id, t.topic_title, t.count_replies, t.count_views, t.status_locked FROM usebb_topics t WHERE t.forum_id = 11 AND t.status_sticky = 0 ORDER BY t.id DESC LIMIT 5");



echo '<ul>';



while ($news = mysql_fetch_array($result)) {



echo '<li><a href="UseBB/topic.php?id='.$news['id'].'">';

echo htmlspecialchars($news['topic_title']).'</a></li>';



}



echo '</ul>';



?>


The same thing that's posted above
Member
Registered: Oct 2005
Posts: 502
Location: Canada
You need to change the following:

WHERE t.forum_id = 11

Change '11' to the forum ID that you are trying to extract the topics from. If there are no topics to extract ( an empty forum ) then it's going to throw that error out instead.

Post Reply

Page: < 1 2

UseBB Community is powered by UseBB 1 Forum Software