PDA

View Full Version : queri help please


RichieBoy67
06-10-2005, 12:12 PM
I want to exclude certain members from the following queri... Thanks :)

$getstats_posters = $DB_site->query("SELECT userid, username, posts FROM " . TABLE_PREFIX . "user ORDER BY posts DESC LIMIT 0, $displayrecords");
while ($getstats_poster = $DB_site->fetch_array($getstats_posters))
{
eval('$stats_posters .= "' . fetch_template('forumhome_stats_poster') . '";');
}

$getstats_members = $DB_site->query("SELECT userid, username, posts, joindate FROM " . TABLE_PREFIX . "user ORDER BY joindate DESC LIMIT 0, $displayrecords");
while ($getstats_member = $DB_site->fetch_array($getstats_members))
{
eval('$stats_members .= "' . fetch_template('forumhome_stats_member') . '";');
}

Marco van Herwaarden
06-10-2005, 12:47 PM
Just add a where clause:
...."user WHERE userid NOT IN (1,2,3) ORDER BY.....

RichieBoy67
06-11-2005, 01:48 AM
Thanks for that Marco :) I don't think I'll ever get my mind wrapped around mysql.... lol

How would I add the same clause to this???

$DB_site->query("SELECT userid, lastactivity, options, username, user.usergroupid, displaygroupid,
groupa.opentag as opentaga, groupa.closetag as closetaga, groupb.opentag as opentagb, groupb.closetag as closetagb
FROM " . TABLE_PREFIX . "user as user
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupa ON(user.usergroupid = groupa.usergroupid)
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupb ON(user.displaygroupid = groupb.usergroupid)
WHERE lastactivity > " .$cutoff. " ORDER BY username" );

Anyone???

Marco van Herwaarden
06-16-2005, 11:28 AM
......
WHERE lastactivity > " .$cutoff. " AND user.userid NOT IN (1,2,3) ORDER BY username" );