db_connect();
/* only pull back the cols you actually need */
$result = mysql_query("SELECT author_id,author_name FROM author");
/* only have to run this once to get total, plus only get count, not entire result set */
$result2 = mysql_query("SELECT count(*) FROM entry WHERE entry_id = '4'");
list($allrows) = mysql_fetch_row($result2);
while ( $a_row = mysql_fetch_assoc( $result ))
{
$name = $a_row['author_name'];
echo "$a_row[author_name]";
$nameid = $a_row['author_id'];
/* again, only need to get count, not all rows */
$result3 = mysql_query("SELECT count(*) FROM entry WHERE entry_author_id = '$nameid' AND entry_blog_id = '4'");
list($rowz_rez) = mysql_fetch_row($result3);
$percentage = round(100/$allrows*$rows_rez,0);
echo ': '.$percentage.' %<br>';
}
... or something like that 🙂 Also, make sure you have keys on entry_id and entry_author_id