sql->query($sql); while($v_rst = $this->sql->fetch_assoc($rst)) $forums[$v_rst["id"]] = $v_rst; } catch(Exception $_e) { $forums = false; } return $forums; } function forum_last_messages($max, $id_forum = null) { $messages = array(); try { $query = "SELECT p.id as post_id, p.posted, t.id as topic_id, t.subject, f.forum_name" ." FROM #--pun_posts p, #--pun_topics t, #--pun_forums f" ." WHERE p.topic_id=t.id" ." AND t.forum_id=f.id" .(isset($id_forum) ? " AND f.id=".$id_forum : "") ." ORDER BY p.posted DESC" ." LIMIT 0,".$max; $rst = $this->sql->query($query); while($v_rst = $this->sql->fetch_assoc($rst)) $messages[$v_rst["post_id"]] = $v_rst; } catch(Exception $_e) { $messages = false; } return $messages; } function nous_y_etions() { // adapter ici avec l'identifiant du forum $forum_id = 84; $post = array(); try { $query = "SELECT p.id as post_id, p.posted, t.id as topic_id, t.subject, f.forum_name" ." FROM #--pun_posts p, #--pun_topics t, #--pun_forums f" ." WHERE p.topic_id=t.id" ." AND t.forum_id=f.id" ." AND f.id=".$forum_id ." ORDER BY RAND()" ." LIMIT 0,1"; $rst = $this->sql->query($query); if($v_rst = $this->sql->fetch_assoc($rst)) $post = $v_rst; } catch(Exception $_e) { $post = false; } return $post; } } ?>