bull
May 15 2004, 11:57 AM
I am trying to make the IPDL latest discussions only pull from selected forums. I have it able to pull from one forum with this code:
CODE
$latest_forum = 1;
$DB->query("SELECT tid, title, posts, starter_id as member_id, starter_name as member_name, start_date as post_date, views FROM ibf_topics WHERE forum_id={$latest_forum} AND state!='closed' AND approved=1 AND (moved_to IS NULL or moved_to='') $qe ORDER BY start_date DESC LIMIT 0,$limit");
Is there a way to change the $latest_forum = 1; to parse more forums?
AceHigh
May 15 2004, 03:35 PM
Try repeating the code for every forum you want to feed, replacing "1" with the appropriate forum ID.
$latest_forum = 1;
$DB->query("SELECT tid, title, posts, starter_id as member_id, starter_name as member_name, start_date as post_date, views FROM ibf_topics WHERE forum_id={$latest_forum} AND state!='closed' AND approved=1 AND (moved_to IS NULL or moved_to='') $qe ORDER BY start_date DESC LIMIT 0,$limit");
$latest_forum = 2;
$DB->query("SELECT tid, title, posts, starter_id as member_id, starter_name as member_name, start_date as post_date, views FROM ibf_topics WHERE forum_id={$latest_forum} AND state!='closed' AND approved=1 AND (moved_to IS NULL or moved_to='') $qe ORDER BY start_date DESC LIMIT 0,$limit");
$latest_forum = 3;
$DB->query("SELECT tid, title, posts, starter_id as member_id, starter_name as member_name, start_date as post_date, views FROM ibf_topics WHERE forum_id={$latest_forum} AND state!='closed' AND approved=1 AND (moved_to IS NULL or moved_to='') $qe ORDER BY start_date DESC LIMIT 0,$limit");
etc
Mandark
May 17 2004, 05:48 PM
how about doing it in a loop so you don't repeat code needlessly? Make the ID a variable in an array or something....
I am GLAD ace is not a developer... ROFL JJ
AceHigh
May 17 2004, 05:50 PM
He got it working, and YES!!!!!!!!! I'm GLAD I'm not a developer. I HATE IT!!!!!!!!!!