FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » sql: display latest topics on homepage
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
sql: display latest topics on homepage [message #23163] Mon, 07 March 2005 12:37
!alex is currently offline  !alex   Germany
Messages: 23
Registered: February 2004
Location: germany
Karma: 0
Junior Member
Here`s a small sql-statement to get the latest topics from the forum.

I use it to display them on all pages of our shop:

Quote:


//use forum`s database:
mysql_query('USE '.$forumDb);

//the query:
SELECT fud25_msg.subject AS ThreadName, fud25_thread.id AS ThreadId
FROM fud25_thread, fud25_msg
WHERE fud25_thread.root_msg_id = fud25_msg.id AND fud25_thread.moved_to = 0
ORDER BY fud25_msg.post_stamp DESC
LIMIT 3

//generate link to topic (for path-info), while loop over results:
"/forum/index.php/t/".$row['ThreadId']."/2/"

//switch back to the other database:
mysql_query('USE '.$yourDatabase);





You can have a look at www.schmid-gartenpflanzen.de

Enjoy,
Alex
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: small typo in rdf.php
Next Topic: The user's options bitmask...
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 06:29:36 GMT 2024

Total time taken to generate the page: 0.02825 seconds