contare i campi? metti nella query COUNT. Sommare gli elementi?
$somma = 0;
while($row = mysql_fetch_array($query)) {
$somma += $row['mem_id'];
}
in $somma la somma.