UseBB Community

The official board for UseBB help and discussion

UseBB Community » Help & Support » How can i put lastest post in UseBB to my html page?

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

Moderators: Gaia.

Page: < 1 2

Author Post
Moderator
Registered: Oct 2005
Posts: 437
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?
Moderator
Registered: Oct 2005
Posts: 437
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
Moderator
Registered: Oct 2005
Posts: 437
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
Moderator
Registered: Oct 2005
Posts: 437
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.

Page: < 1 2

UseBB Community » Help & Support » How can i put lastest post in UseBB to my html page?

UseBB Community is powered by UseBB 1 Forum Software