while ($row = mysql_fetch_array($res)) { $vistas=$row['views']; $total+=$vistas; // ESTO $total_de_registros = mysql_num_rows($res);