$sqlgroup = "select id,count(name) as name from table where year(`today_insert`) = '2009' and month(`today_insert`) = '10' group by id order by name desc";
while ( $rsgroup = mysql_fetch_array($result) )
{
echo "ID$rsgroup['id']} </a>มี {$rsgroup['name']}จำนวน<br />";
}
select id,count(name) as name ,(select count(name) from table ) as allCount from table where year(`today_insert`) = '2009' and month(`today_insert`) = '10' group by id order by name desc";
$sql1="select count(name) as CountNM from table ";
$row1=mysql_fetch_array(mysql_query($sql1));
$CountNM=$rsgroup['CountNM'] ; //
$sqlgroup = "select id,count(name) as name from table where year(`today_insert`) = '2009' and month(`today_insert`) = '10' group by id order by name desc";
$result=mysql_query($sqlgroup);
while ( $rsgroup = mysql_fetch_array($result) ){
$sumAll=($rsgroup['name'] / $CountNM) * 100;
echo "ID:{$rsgroup['id_baby']}มี {$rsgroup['name']}จำนวน $sumAll % <br>";
}
<?php
$conn = mysql_pconnect('localhost', 'root','') or die(mysql_error());
$select = mysql_select_db('database') or die(mysql_error());
$sql1="select count(name) as CountNM from table";
$row1=mysql_fetch_array(mysql_query($sql1));
$CountNM=$rsgroup['CountNM'] ; //
$sqlgroup = "select id,count(name) as name from table where year(`today_insert`) = '2009' and month(`today_insert`) = '10' group by id order by name desc";
$result=mysql_query($sqlgroup);
while ( $rsgroup = mysql_fetch_array($result) ){
$sumAll=($rsgroup['name'] / $CountNM) * 100;
echo "ID:{$rsgroup['id']}มี {$rsgroup['name']}จำนวน $sumAll % <br>";
}
?>