ลืมเรียงลำดับให้ ขอแก้ตัวใหม่
<?php
include "connect.php";
$sqlgroup = "SELECT id, sum(vote) as sum_vote FROM tb_sumvote GROUP BY id ORDER BY sum(vote) DESC";
$result = mysql_query($sqlgroup,$conn); $i=1;
while ( $rsgroup = mysql_fetch_array($result) )
{ echo "$i ID {$rsgroup['id']} ={$rsgroup['sum_vote']} <br />";
$i++;
}
<?php
$conn = mysql_pconnect('localhost', 'root', '') or die(mysql_error());
$select = mysql_select_db('Database') or die(mysql_error());
$sqlgroup = "SELECT id, sum(vote) as sum_vote FROM tb_sumvote GROUP BY id ORDER BY sum(vote) DESC";
$result = mysql_query($sqlgroup,$conn);
while ( $rsgroup = mysql_fetch_array($result) )
{
echo "ข้อมูล : {$rsgroup['id']} = {$rsgroup['vote']}<br />";
}
?>