Use mysql_fetch_array() instead.
that will return your results in an associative array, allowing you to access the values by their table column names
$row=mysql_fetch_array($result)
echo $row['COLUMN_NAME']
etc.
actually I think I misread your question.....
try something along the lines of
$row=mysql_fetch_array($result);
$row_count = count($row);
$num_range = range(0, $row_count);
for ($i = 0; $i < $row_count; $i++) {
if (SOME_CONDITION) {
break;
}
else {
do something else with $row[$i];
}
where break will advance to the next row if your condition is true.