View Single Post
  #10  
Old 17-10-2004, 21:41
Magi-X's Avatar
Magi-X Magi-X is offline
Modérateur
1 Highscore
 
Join Date: 31-10-2002
Location: Bruxelles
Age: 41
Posts: 816
Send a message via MSN to Magi-X
voila, comme promis je te donne mon code que j'ai fais a l'époque

PHP Code:
// take the last topic in the news room -> id = 2                
$sql_get_news mysql_query("SELECT * FROM mov_topics WHERE forum_id = 2 ORDER BY topic_time DESC LIMIT 1");
$get_news mysql_fetch_array($sql_get_news);
                    
// get the nr of replies
$sql_get_replies mysql_query("SELECT topic_replies FROM mov_topics WHERE topic_id = ".$get_news['topic_id']);
$get_replies mysql_fetch_array($sql_get_replies);
                    
// get to poster who made the topic
$sql_get_poster mysql_query("SELECT username FROM mov_users WHERE "$get_news['topic_poster'] ." = user_id");
$get_poster mysql_fetch_array($sql_get_poster);
                    
// get to body of the topic
$sql_get_body mysql_query("SELECT * 
                    FROM     mov_posts, 
                        mov_posts_text 
                    WHERE 
                        mov_posts.topic_id = "
$get_news['topic_id'] ."
                    AND
                        mov_posts.poster_id = "
$get_news['topic_poster'] ."
                    AND
                        mov_posts_text.post_id = mov_posts.post_id
                    ORDER BY 
                        mov_posts.topic_id ASC LIMIT 10"
);
$get_body mysql_fetch_array($sql_get_body); 
il faudra naturellement changer les paramettres en fonction de ta config.
Reply With Quote