Calculating a percentage
Posted: Sun Jan 04, 2004 1:23 pm
I have the following that displays info on browsers used to view a site. How do I change it to calculate the percentage for each type of browser? I need it to show in place of the hardcoded 50%.
Code: Select all
function browser() {
$sql ="SELECT browser, hits FROM stats_browser
ORDER BY hits DESC LIMIT 10";
$browse = mysql_query($sql) or die(mysql_error());
echo "<table width='95%' align='center' class='sborder'>
<tr>
<td colspan='4' class='statsheader'><b>Browser's : </b> top 10 ( <a href='http://www.test.site.com/e107/stats.php?1'>View all</a> )</td>
</tr>\n";
do
echo "<tr>
<td style='width:25%' class='statsheader'>".$row_browseї'browser']."</td>
<td nowrap style='width:55%' class='statsheader'>".mk_percbar($mise,200,"$msieї1] %")."</td>
<td style='width:10%; text-align:center' class='statsheader'>".$row_browseї'hits']."</td>
<td style='width:10%; text-align:center' class='statsheader'>50%</td>
</tr>\n";
while ($row_browse = mysql_fetch_assoc($browse));
echo "</table>\n";
}