Easier:
$query="SELECT SUM(points) AS `total` from members2";
$result=mysql_query($query);
while($row=mysql_fetch_assoc($result))
$total = $row['total'];
If you want to limit the sum to certain sets of data, you will have to use the GROUP BY function in mysql. Learning about grouping and its associated functionality will help you avoid a lot of tedious, repetitive coding.