Jump to content


Photo

male/female


  • Please log in to reply
1 reply to this topic

#1 fullyloaded

fullyloaded
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 15 April 2006 - 08:57 PM

hi
i was wondering if anyone can help me with a small pice of coding i have in my website?what im trying to do is get the total number of males signed up to my website and the same for females also.ok here is the code i have to show how many members i have signed up witch would be under (member)and for there gender its under member then (gender)is there anyway this can be done?thanks...


$dbu->query('SELECT COUNT(*) AS rowcount FROM member');
$dbu->move_next();
$ft->assign('MEMBER', $dbu->f('rowcount'));

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,023 posts

Posted 15 April 2006 - 11:05 PM

$res = mysql_query ("SELECT gender, COUNT(*) 
              FROM members
              GROUP BY gender");

while (list ($gender, $total) = mysql_fetch_row($res)) {

       echo "$gender : $total <br>";
}

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users