I don't know what kind of values you're using, but try a SQL query like:
$query = 'SELECT COUNT(*) AS males FROM member WHERE gender=\'male\'';
Then, once you retrieve the number of males, simply subtract that number from the total number of members and you also have the number of females.