Is it possible to include multiple usergroups in this, or just one?
Yes, sure. You can do it on 2 ways:
1.- Changing the "where" argument from WHERE usergroupid=2, to WHERE usergroupid=2 OR usergroupid=3 OR usergrooupid=7 . In this example we assume that you want to include members who belong to usergroups 2,3,7
2.- By using an array. At the top of the file add:
1.- Changing the "where" argument from WHERE usergroupid=2, to WHERE usergroupid=2 OR usergroupid=3 OR usergrooupid=7 . In this example we assume that you want to include members who belong to usergroups 2,3,7
2.- By using an array. At the top of the file add:
Got the following database error because I have the majority of users are imported from a previous board. The user name is REGISTERED and the user I.D. is 31. I edited the code as you said... but it didn't work. Any ideas?
Database error in vBulletin 4.0.0:
Invalid SQL:
SELECT user.userid, user.username, user.usertitle,
COUNT(post.postid) AS postcount
FROM user
LEFT JOIN post
ON post.userid=user.userid
AND dateline>'1262563200'
WHERE usergroupid=2 OR to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LIMIT 5;
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LI' at line 7
Error Number : 1064
Request Date : Wednesday, January 6th 2010 @ 07:00:10 PM
Error Date : Wednesday, January 6th 2010 @ 07:00:11 PM
Script : http://www.microlightforum.com/content.php?121
Referrer : http://www.microlightforum.com/content.php?142
IP Address : 90.194.162.111
Username : VinceG
Classname : vB_Database
MySQL Version : 5.0.87-community
Got the following database error because I have the majority of users are imported from a previous board. The user name is REGISTERED and the user I.D. is 31. I edited the code as you said... but it didn't work. Any ideas?
Database error in vBulletin 4.0.0:
Invalid SQL:
SELECT user.userid, user.username, user.usertitle,
COUNT(post.postid) AS postcount
FROM user
LEFT JOIN post
ON post.userid=user.userid
AND dateline>'1262563200'
WHERE usergroupid=2 OR to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LIMIT 5;
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to WHERE usergroupid=31
GROUP BY user.userid
ORDER BY postcount DESC
LI' at line 7
Error Number : 1064
Request Date : Wednesday, January 6th 2010 @ 07:00:10 PM
Error Date : Wednesday, January 6th 2010 @ 07:00:11 PM
Script : http://www.microlightforum.com/content.php?121
Referrer : http://www.microlightforum.com/content.php?142
IP Address : 90.194.162.111
Username : VinceG
Classname : vB_Database
MySQL Version : 5.0.87-community
Please, don't say so easy "didn't work" and "broke my site", before you're totally sure that you did everything correct.
In your case, you wrote "WHERE usergroupid=2 OR to WHERE usergroupid=31" while the correct is "WHERE usergroupid=2 OR usergroupid=31". Why you added more "to WHERE"?