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 :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
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 07:37
!alex is currently offline  !alex   Germany
Messages: 23
Registered: February 2004
Location: germany
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
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
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
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: Wed Oct 18 00:01:08 EDT 2017

Total time taken to generate the page: 0.00505 seconds