Counting in array (php)
Gstone Offline
Member
***
Posts: 55
Joined: May 2012
Post: #1
Counting in array (php)
hello again,

I added this to my index.php file for mybb:

Code:
1
2
3
4
5
6
$num_male = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "fid3='Male'"), "count");
$num_female = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "fid3='Female'"), "count");

// Not set
$stats_cache = $cache->read("stats");
$num_notset = $stats_cache['numusers'] - $num_aldmeri - $num_daggerfall


My problem is, how would i change this code to use an array instead? something such as counting Male, Female, Not Set all together, but at the same time i can still use the above to count them individually too.

(i know the numusers will count all of them together, but this is for a different purpose other than Gender field).

(This post was last modified: 09-13-2012 02:08 PM by Gstone.)
09-13-2012 02:07 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Counting in array (php) - Gstone - 09-13-2012 02:07 PM
RE: Counting in array (php) - Sama34 - 09-13-2012, 03:05 PM
RE: Counting in array (php) - Gstone - 09-14-2012, 06:44 PM
RE: Counting in array (php) - Gstone - 09-13-2012, 03:07 PM
RE: Counting in array (php) - ZiNgA BuRgA - 09-13-2012, 07:07 PM
RE: Counting in array (php) - ZiNgA BuRgA - 09-14-2012, 09:58 PM

 Standard Tools
Forum Jump: