$result = pg_exec("select * from game where game11 = 'ON' and game9 > '2001-7-1' and game1<>461 and game1<>498 order by rank7 desc limit 5");
$rows = pg_numrows($result); // 行数を取得
$columns = pg_numfields($result); // 列数を取得
for ($j = 0;$j < 5;$j++) {
for ($k=0;$k<$columns;$k++){
$str[$k]=pg_result($result,$j,$k);
}
$rank=$j+1;
?>
//[総合]////////////////////////////////
$result=pg_exec("select count(*),vote_all,game3,game4 from p_tohyo,game where ranknum=$num and vote_all=game.game1 group by vote_all,game3,game4 order by count(*) desc");
$rows=pg_numrows($result);
$i=0;
do{
$count=pg_result($result,$i,0);
$next_count=pg_result($result,$i+1,0);
$vote=pg_result($result,$i,1);
$name=pg_result($result,$i,2);
$url=pg_result($result,$i,3);
echo "
$result=pg_exec("select count(*),vote_prog,game3,game4 from p_tohyo,game where ranknum=$num and vote_prog=game.game1 group by vote_prog,game3,game4 order by count(*) desc");
$rows=pg_numrows($result);
$i=0;
do{
$count=pg_result($result,$i,0);
$next_count=pg_result($result,$i+1,0);
$vote=pg_result($result,$i,1);
$name=pg_result($result,$i,2);
$url=pg_result($result,$i,3);
echo "
$result=pg_exec("select count(*),vote_chara,game3,game4 from p_tohyo,game where ranknum=$num and vote_chara=game.game1 group by vote_chara,game3,game4 order by count(*) desc");
$rows=pg_numrows($result);
$i=0;
do{
$count=pg_result($result,$i,0);
$next_count=pg_result($result,$i+1,0);
$vote=pg_result($result,$i,1);
$name=pg_result($result,$i,2);
$url=pg_result($result,$i,3);
echo "
$result=pg_exec("select count(*),vote_music,game3,game4 from p_tohyo,game where ranknum=$num and vote_music=game.game1 group by vote_music,game3,game4 order by count(*) desc");
$rows=pg_numrows($result);
$i=0;
do{
$count=pg_result($result,$i,0);
$next_count=pg_result($result,$i+1,0);
$vote=pg_result($result,$i,1);
$name=pg_result($result,$i,2);
$url=pg_result($result,$i,3);
echo "