table

For example, there is a code that displays the last added estimates.

$limit = $limit ? intval($limit) : "20"; if (!$r_short) { $sql = $db->query("SELECT * FROM " . PREFIX . "_logs ORDER BY id DESC LIMIT 0,{$limit}"); while ($row = $db->get_row($sql)) { $r_short .= "<div class=\"ratefull\">{$row['member']} <span>оценка {$row['rate']}</span></div>"; } } echo $r_short; 

Need to withdraw who and how many ratings set? That is, you need to calculate how many identical names in the member column and sort them in descending order ( noname , this guests do not need to count them).

For example:

admin - 100 ratings

admin2 - 50 ratings

...

    2 answers 2

     $db->query("SELECT member, count(*) as rates FROM " . PREFIX . "_logs WHERE member <> 'noname' GROUP BY member ORDER BY rates" ); 
    • How to number this whole thing? 1 admin - 100оц ... 2 admin - steep

    Use GROUP BY

     SELECT member, count(member) as cnt, sum(rate) as s_rate FROM <tablename> WHERE member!='noname' GROUP BY member ORDER BY cnt;