View Full Version : php code for # of peeps in X user group
Jake Bunce
Fri 31st Aug '01, 4:29am
http://130.94.172.202/clan.php
i want to add that functionality to the above page. just a member count for that user group. what code would i add to the script to get this functionality?
Bane
Fri 31st Aug '01, 7:36am
$macnum = mysql_num_rows(mysql_query("select * from user WHERE usergroupid =XX "));
... I think :p
Jake Bunce
Fri 31st Aug '01, 11:49pm
and then the $macnum variable gets put into the appropriate template, right?
well, whatever. i'll try this when i get home tonight. :)
JamesUS
Sat 1st Sep '01, 4:32am
You could also do:
$macnum = $DB_site->query("SELECT COUNT(*) AS count FROM user WHERE usergroupid='1'");
then use $macnum[count] in the template.
Jake Bunce
Sat 1st Sep '01, 4:35am
didn't work. i'm attaching the file in question. maybe i'll get lucky and some one will mod the file and upload it here for me. :D
i changed the extension to .txt for attachment purposes.
Jake Bunce
Sat 1st Sep '01, 4:36am
hold the phone. i'll try jame's sug.
Jake Bunce
Sat 1st Sep '01, 4:41am
not working... due to my extremely limited php knowledge i'm sure. i'm all putting that statement in different parts of the script trying to get it working. the script kept coming up saying call to undefined function and stuff. i have no idea.
Jake Bunce
Sun 2nd Sep '01, 9:54pm
shameless bump :D
Bane
Tue 4th Sep '01, 4:58pm
OK, try this.. this worked for me with your templates.
Find (in your clan.php)
eval("\$moderatorbits .= \"".gettemplate("showmods_bit")."\";");
}
Just under that put..
$macnum = mysql_num_rows(mysql_query("select * from user WHERE usergroupid =$clan_usergroup"));
then place $macnum where you want it in your clan template. lemme know if this works. http://www.talkloud.net/clan.php. note the 4 floating up there.
Bane
Wed 5th Sep '01, 3:26am
Heres the file. This works on my server.
Jake Bunce
Wed 5th Sep '01, 3:56am
it works. thx dude. :)
Bane
Wed 5th Sep '01, 3:59am
Sweet :) I was a bit worried there! Glad I could help.
vBulletin® v3.8.0 Beta 3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.