Ouwe rakker |
|
Wat vind je van dit:
<?php
include 'connect.inc.php';
$qGetSex = mysql_query("SELECT `sex`, COUNT(*)
FROM `user`
GROUP BY `sex`");
$aSex['male'] = mysql_result($qGetSex, 1, 1);
$aSex['female'] = mysql_result($qGetSex, 0, 1);
$aTotal['male'] = round(100 * ($aSex['male'] / ($aSex['male'] + $aSex['female'])), 1);
$aTotal['female'] = round(100 - $aTotal['male'], 1);
?>
We have a total of <b><?= ($aSex['male'] + $aSex['female']); ?></b> members.<br />
There is a total of <b><?= $aSex['male']; ?></b> (<?= $aTotal['male']; ?>%) males and a total of <b><?= $aSex['female']; ?></b> (<?= $aTotal['female']; ?>%) females.
<?php include 'connect.inc.php'; FROM `user` GROUP BY `sex`"); $aTotal['male'] = round(100 * ($aSex['male'] / ($aSex['male'] + $aSex['female'])), 1); $aTotal['female'] = round(100 - $aTotal['male'], 1); ?> We have a total of <b><?= ($aSex['male'] + $aSex['female']); ?></b> members.<br /> There is a total of <b><?= $aSex['male']; ?></b> (<?= $aTotal['male']; ?>%) males and a total of <b><?= $aSex['female']; ?></b> (<?= $aTotal['female']; ?>%) females.
|