Greetings!
I manage a directory of former students of different schools.
The interface is a Flash (.swf) file to which I send a Flash String.
For each school, I display various searches (by name, promotion, geographical location, etc).
I also display in a "Hall of Fame" the rankings related:
a - to the total of students listed for each school.
b - to the total of registered students using the directory.
(code below)
<?php
include "key.php";
// $table may be $table_one (listed) or $table_two (users)
$query = "SELECT school, COUNT( * ) AS n FROM $table GROUP BY shool HAVING ( n > 0 ) ORDER BY n DESC";
$res = mysql_query($query) or die("&error=Impossible to connect");
while (list($school, $n) = mysql_fetch_row($res)) {
$flashstr .= "$n"." - "."$school"."<br />";
}
print "&fulllist=".urlencode($flashstr);
?>
I wish to display another new ranking based upon the "ratio" in percentage (FOR EACH SCHOOL) obtained by comparing the results of listed and users.
EXAMPLES :
listed :
120 - School C
80 - School A
50 - School B
30 - School D
etc...
users :
40 - School A
10 - School B
10 - School C
5 - School D
etc...
I want to obtain :
50.00% - School A
48.00% - School E
20.00% - School B
16.66% - School D
8.33% - School C
7.00% - School H
3.00% - School W
etc...
For a better understanding of my problem, please see the sample of what I obtain by applying my queries to table_one and table_two at this link
I want to obtain the ratio FOR EACH SCHOOL of users (green numbers) vs listed (red numbers) and then order those ratios by descending order.
This is very tricky for me!
Many thanks in advance for any solution.
Best regards.
Gerry