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
Return to the default flat view 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:
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
[Message index]
 
Read Message
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: Sat Nov 30 23:29:28 GMT 2024

Total time taken to generate the page: 0.04365 seconds