[PHP] Re: Table statistics

2003-11-16 Thread Kim Steinhaug
Well, Im about to create some statistics systems myself and havnt really
starter
thinking of the optimal way of doing such calculations so this thread will
be much
interesting.

I would suggest the following :

As you have already pulled out all the data from that month, we need to
prosess this.
I would create a 2 dimensional array for every Screen_ Name,

// Initiate array
$count = array();

// Loop through your data and assign all the users like this
$count[$Screen_ Name] = 0;

This will give you an array of all the users, then you could loop through
the data again and
add 1 for each instance of the user to meassure the counts :
$count[$Screen_ Name]++;

Finally you sort the array and print out the first 5.

(The 2 last steps should be put together since its no use going through the
data twice)

-- 
Kim Steinhaug
---
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---


Daniel Harik [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I have table with messages, and i have users table, the are  linked via PK
 UserID - UserID, what i need is to select Messages for current month and
 calculate top 5 posters list for current month.

 I have create following query but it's not complete:

 SELECT Handle, Screen_Name from MBoard where Message_Date='2003-11-00'
ORDER BY Handle;

 this gets me all messages posted this month ordered by userid


 Thank You.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Table statistics

2003-11-16 Thread Kim Steinhaug
By the way, while I write the message I forgot to correct the
2 dimentional array to array...

Context is everything, :)

-- 
Kim Steinhaug
---
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---


Kim Steinhaug [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Well, Im about to create some statistics systems myself and havnt really
 starter
 thinking of the optimal way of doing such calculations so this thread
will
 be much
 interesting.

 I would suggest the following :

 As you have already pulled out all the data from that month, we need to
 prosess this.
 I would create a 2 dimensional array for every Screen_ Name,

 // Initiate array
 $count = array();

 // Loop through your data and assign all the users like this
 $count[$Screen_ Name] = 0;

 This will give you an array of all the users, then you could loop through
 the data again and
 add 1 for each instance of the user to meassure the counts :
 $count[$Screen_ Name]++;

 Finally you sort the array and print out the first 5.

 (The 2 last steps should be put together since its no use going through
the
 data twice)

 -- 
 Kim Steinhaug
 ---
 There are 10 types of people when it comes to binary numbers:
 those who understand them, and those who don't.
 ---


 Daniel Harik [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hello,
 
  I have table with messages, and i have users table, the are  linked via
PK
  UserID - UserID, what i need is to select Messages for current month
and
  calculate top 5 posters list for current month.
 
  I have create following query but it's not complete:
 
  SELECT Handle, Screen_Name from MBoard where Message_Date='2003-11-00'
 ORDER BY Handle;
 
  this gets me all messages posted this month ordered by userid
 
 
  Thank You.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php