Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
archtype
New Member
New Member


Joined: Apr 30, 2005
Posts: 9

PostPosted: Mon Jul 18, 2005 12:21 pm Reply with quote

I am going the long way around to accomplish something. I wanted to try to create a prayer request module that would have a scrolling block for the main page but don't know PHP and am teaching myself. Having said that, in the meantime, I decided to create a forum to enter names in the title for prayer requests and scroll them using a scrolling forum block but my problem is this: I only want the forum block to scroll from this forum only. How could I modify the code to accomplish this. It, for this purpose, would be much easier to specify which forums to show rather than which ones to hide.
Any help is much appreciated!

Thanks!
 
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17077

PostPosted: Mon Jul 18, 2005 12:49 pm Reply with quote

You will need to add a WHERE clause to your SQL statement, limiting the forum id. It will be something like
Code:
WHERE forum_id=99

Of course the '99' will need to be the forum_id of the forum you actually want.


Last edited by Raven on Sat Aug 06, 2005 6:03 am; edited 1 time in total 
View user's profile Send private message
archtype
PostPosted: Mon Jul 18, 2005 12:54 pm Reply with quote

Thank you so much for your quick reply. I was just looking at the query and about to try that exact thing! Thank you for validating my radom and rambling thoughts.
 
archtype
PostPosted: Mon Jul 18, 2005 6:55 pm Reply with quote

OK, that worked! Thank you very much! Next question/problem. I am using a different scrolling block for the Main forums scroll. Can someone take a look at it and help me out with it? I am trying to make it not display one forum, just the opposite of my first request. I have tried the NOT IN statement and can't seem to get it right. I would be very appreciative if anyone could take a look and point me in the right direction. Thanks very much and here's a snippet of the query code:
Code:
$result1 = $db->sql_query("SELECT

 t.topic_id, t.topic_last_post_id, t.topic_title,
 f.forum_name, f.forum_id,
 u.username, u.user_id,
 p.poster_id, FROM_UNIXTIME(p.post_time,'%b %d, %Y at %T') as post_time
 FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f
 LEFT JOIN ".$prefix."_bbposts p ON (p.post_id = t.topic_last_post_id)
 LEFT JOIN ".$prefix."_users u ON (u.user_id = p.poster_id)
 WHERE t.forum_id=f.forum_id AND f.auth_view=0
 ORDER BY t.topic_last_post_id DESC
 LIMIT 20");
while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id, $username, $user_id, $poster_id, $post_time) = $db->sql_fetchrow($result1)) {


EDIT:
Nevermind. I figured it out. Here is the query I used to fix it. If anyone sees anything wrong with it, please let me know.
Thanks and here's the query:
Code:
$result = $db->sql_query("SELECT t.topic_id, t.topic_last_post_id,

t.topic_title, f.forum_name, f.forum_id, u.username, u.user_id,
p.poster_id, FROM_UNIXTIME(p.post_time,'%b %d, %Y at %T') as post_time FROM
".$prefix."_bbtopics t, ".$prefix."_bbforums f LEFT JOIN
".$prefix."_bbposts p ON (p.post_id = t.topic_last_post_id) LEFT JOIN
".$prefix."_users u ON (u.user_id = p.poster_id) WHERE
t.forum_id=f.forum_id AND f.auth_view=0 AND f.forum_id !='14' ORDER BY
t.topic_last_post_id DESC LIMIT 20");
 
Raven
PostPosted: Mon Jul 18, 2005 7:11 pm Reply with quote

Change
Code:
WHERE t.forum_id=f.forum_id AND f.auth_view=0


to
Code:
WHERE t.forum_id != 99 AND t.forum_id=f.forum_id AND f.auth_view=0

or
Code:
WHERE f.forum_id != 99 AND t.forum_id=f.forum_id AND f.auth_view=0
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©