Bonjour à tous,
Je dispose d'un forum et d'une page d'accueil qui indique les 10 derniers messages postés sur ce forum.
Le soucis c'est que la fonction que j'utilise prend en compte tous les forums sans exception. Est-ce possible d'exclure certains forums ? (Par leur id ?)
Si oui, pourriez-vous m'indiquer la marche à suivre car j'avoue être quelque peu perdu à ce niveau.
Voici la fonction :
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 function get_10last_posts(){ global $usergid; connect_to_db(); $query = mysql_query(" SELECT t.subject, t.last_post, t.last_poster, t.last_post_id FROM pun_topics AS t LEFT JOIN pun_forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='".$usergid."') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL ORDER BY t.last_post DESC LIMIT 0, 10 "); if(!$query){echo 'toto';} echo '<ul>'; while($post = mysql_fetch_array($query)){ $time = date("H:i", $post['last_post']); echo '<li><a href="forum/viewtopic.php?pid='.$post['last_post_id'].'#p'.$post['last_post_id'].'">'.$time.' '.$post['subject'].'</a><span class="lastposter"> '.$post['last_poster'].'</span></li>'; } echo '</ul>'; }
Merci d'avance pour votre aide.
Partager