Home »
FUDforum Development »
Plugins and Code Hacks »
sql: display latest topics on homepage
sql: display latest topics on homepage [message #23163] |
Mon, 07 March 2005 12:37 |
!alex
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
|
|
|
Goto Forum:
Current Time: Thu Dec 26 19:33:45 GMT 2024
Total time taken to generate the page: 0.02612 seconds