
04-21-2012, 12:59 PM
|
|
|
Join Date: Oct 2006
Location: Toronto
Posts: 1,789
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Hi Chris ... 
'
Ok, I made the changes, but now get this SQL error?
Did I miss something?
Quote:
Database error in vBulletin 4.1.3:
Invalid SQL:
SELECT COUNT(post.dateline) AS postcount, post.userid,
user.userid, user.username, user.lastpostid, user.posts, user.usergroupid
FROM post AS post
JOIN user AS user ON (post.userid = user.userid)
WHERE user.posts != '0' AND user.usergroupid IN(Array) AND post.dateline>'1334411824'
GROUP BY post.userid
ORDER BY postcount DESC
LIMIT 4;
MySQL Error : Unknown column 'Array' in 'where clause'
Error Number : 1054
Request Date : Saturday, April 21st 2012 @ 09:57:03 AM
Error Date : Saturday, April 21st 2012 @ 09:57:04 AM
Script : http://www.xxxx.com/memberlist.php
Referrer : http://www.xxxx.com/index.php
IP Address : xx.xxx.xxx.xxx
Username : Tester
Classname : vB_Database
MySQL Version : 5.0.95
|
Thanks...
Regards,
Doug
By the way, here's the code the way I changed it...
Quote:
// Week's Top Posters
// Put the usergroupids that you want to include
$include_groups = array(2,9,10);
if ($vbulletin->options["forummembers_week"] == '1') {
$timelimit = time() - 7 * 24 * 60 * 60;
$mostactiveweek_get = $db->query_read("
SELECT COUNT(post.dateline) AS postcount, post.userid,
user.userid, user.username, user.lastpostid, user.posts, user.usergroupid
FROM " . TABLE_PREFIX . "post AS post
JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
WHERE user.posts != '0' AND user.usergroupid IN($include_groups) AND post.dateline>'".$timelimit."'
GROUP BY post.userid
ORDER BY postcount DESC
LIMIT $limit
");
$users = array();
while($user = $db->fetch_array($mostactiveweek_get))
{
$users[] = $user;
$totalposts = $db->query_first("SELECT COUNT(postid) AS postcount FROM ".TABLE_PREFIX."post WHERE dateline>'".$timelimit."'");
$mostactiveusersweek = printUsers($users, $vbulletin->options['forummembers_week_text'], 2, $totalposts['postcount']);
unset($users);
}
}
// Month's Top Posters
// Put the usergroupids that you want to include
$include_groups = array(2,9,10);
if ($vbulletin->options["forummembers_month"] == '1') {
$timelimit = time() - 30 * 24 * 60 * 60;
$mostactivemonth_get = $db->query_read("
SELECT ".TABLE_PREFIX."user.userid, ".TABLE_PREFIX."user.username, ".TABLE_PREFIX."user.usertitle,
COUNT(".TABLE_PREFIX."post.postid) AS postcount
FROM ".TABLE_PREFIX."user
LEFT JOIN ".TABLE_PREFIX."post
ON ".TABLE_PREFIX."post.userid=".TABLE_PREFIX."user.u serid
AND dateline>'".$timelimit."'
WHERE user.usergroupid IN($include_groups)
GROUP BY ".TABLE_PREFIX."user.userid
ORDER BY postcount DESC
LIMIT $limit");
$users = array();
while($user = $db->fetch_array($mostactivemonth_get))
$users[] = $user;
$totalposts = $db->query_first("SELECT COUNT(postid) AS postcount FROM ".TABLE_PREFIX."post WHERE dateline>'".$timelimit."'");
$mostactiveusersmonth = printUsers($users, $vbulletin->options['forummembers_month_text'], 2, $totalposts['postcount']);
unset($users);
}
// Overall Top Posters
// Put the usergroupids that you want to include
$include_groups = array(2,9,10);
if ($vbulletin->options["forummembers_overall"] == '1') {
$mostactive_get = $db->query_read("
SELECT userid, username, usertitle, posts AS postcount
FROM ".TABLE_PREFIX."user
WHERE user.usergroupid IN($include_groups)
ORDER BY posts DESC
LIMIT $limit");
$users = array();
while($user = $db->fetch_array($mostactive_get))
$users[] = $user;
$totalposts = $db->query_first("SELECT COUNT(postid) AS postcount FROM ".TABLE_PREFIX."post");
$mostactiveusers = printUsers($users, $vbulletin->options['forummembers_overall_text'], 2, $totalposts['postcount']);
unset($users);
}
|
|