Code: Select all
if(in_array($topic_id, $ingnored_topics))
{
whatever you want to do...
}
Code: Select all
'and topic_id not in (' . implode(',',$ignored_topics) . ')'
Code: Select all
//
// Get ignored topics
//
if ( $userdata['session_logged_in'] )
{
$sql = "SELECT ignore_topic_id
FROM " . IGNORETOPIC_TABLE . "
WHERE user_id = " . $userdata['user_id'];
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error getting ignore listing', '', __LINE__, __FILE__, $sql);
}
$ignoredtopic_ids = array();
$ignoredtopic_sql = '';
while( $row = $db->sql_fetchrow($result) )
{
$ignoredtopic_ids[$row['ignored_topic_id']] = true;
$ignoredtopic_sql .= ' , ' . $row['ignored_topic_id'];
}
if ( $ignoredtopic_sql != '' )
{
$ignoredtopic_sql = ' AND topic_id NOT IN (' . substr($ignoredtopic_sql, 2) . ' )';
}
}
Code: Select all
implode(',',$ignored_topics)
drathbun wrote: Adding "exclusion" logic to a query can really slow it down... exclusion logic like "and topic_id NOT IN (1, 2, 3)" is about the worst thing you can do for performance, especially if the list gets long.
Code: Select all
$message = $searchset[$i]['post_text'];
$topic_title = $searchset[$i]['topic_title'];
Code: Select all
if (isset($ignore_topid_ics[$search_set[$i]['topic_id]]))
{
$message = $ignore_message;
$topic_title = $ignore_title;
}
Yeah, that's true. You'd probably also end up with alternating row colors that don't alternate properly... did not think of that, but you're absolutely right.Brf wrote: Well... that works fine as long as you do not have pagination.
Search only returns like 20 at a time, and if you are skipping some, you might end up with short pages, or some pages with nothing at all on them.