Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Looking for some SQL help

 
Post new topic   Reply to topic Printable version
 View previous topic  Spyware Attack... Post :: Post Anyone Else going to the rush concert ...  View next topic  
Author Message
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:41
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Tue Aug 10, 2004 12:33 pm   Post maybe stupid    Post subject: Looking for some SQL help Reply to topic Reply with quote

Ok, I'm going to give a bit of effort into making an Ignore thread feature. To do so, I'll need a bit of SQL help. I'd like to make the SQL database ignore the threads for me, but am not sure how to go about it. Here is the current sql call for getting the list of threads:

Code: Show/Hide
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
   FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
   WHERE t.forum_id = $forum_id
      AND t.topic_poster = u.user_id
      AND p.post_id = t.topic_first_post_id
      AND p2.post_id = t.topic_last_post_id
      AND u2.user_id = p2.poster_id
      AND t.topic_type <> " . POST_ANNOUNCE . "
      AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . "
      $limit_topics_time
   ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
   LIMIT $start, ".$per_page;


The IGNORE_THREAD table is formated like this: user_id, thread_id. I'd like to throw into this SQL where it will not match if the thread_id is equal to one in the IGNORE_THREAD table in which the user_id's of the two lines match.

Once someone helps on this, it will be simple to add into the index.php and adding in the needed links to ignore the thread.
Back to top
View users profile Send private message Add User to Ignore List Send email
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Aug 10, 2004 12:45 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

add IGNORE_THREAD table as i to the FROM, and then AND i.user_id = u.user_id AND i.thread_it <> t.whatever_the_thread_id_is_called.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:38
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Tue Aug 10, 2004 12:57 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

So that would only select the records in the IGNORE_THREAD table which have the same user ID but not the same thread ID?

Guess that'd be the easiest way then, I started messing with IN (). icon_sad.gif
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Aug 10, 2004 1:02 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

You're right. That wouldn't work unless everyone had an entry in the ignore table.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:41
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Tue Aug 10, 2004 1:09 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I could always just do a check on every thread inside of PHP, but figured there maybe a better way.
Back to top
View users profile Send private message Add User to Ignore List Send email
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:38
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Tue Aug 10, 2004 1:56 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Well, if you're using Brain's way let's add a thread_id = -1 for every user_id. sa_tongue.gif
And of course make sure new users get an entry too. icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Trash Talk All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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 cannot attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 282 page(s) served in previous 5 minutes.

phpBB Created this page in 0.825634 seconds : 29 queries executed (93.5%): GZIP compression disabled