mysql_num_rows
Ver originalfor ($AnioVal, $total = mysql_num_rows($result); $AnioVal <= $total; $AnioVal++) { //...}