Trouble with a dynamically created drop down menu

The following will make a drop down with each skill it finds in the users table. It will also show the total number in parenthesis. My problem, however, is that the first entry in the drop down menu is (0). All the rest display correctly. What am I missing here?

Thanks!!

$findSkills = “select skills, count(*) as total from users where skills != ‘None’ group by skills order by skills”;

$result = mysql_query ($findSkills) OR die(mysql_error());

do {

$skill = $row[“skills”];
$total = number_format($row[“total”]);
$pageContent .= “<option value=‘$skill’>$skill ($total)</option>”;

} while($row = mysql_fetch_array($result));

Hi
Try with simple while().

while($row = mysql_fetch_array($result)) {
  $skill = $row["skills"];
  $total = number_format($row["total"]);
  $pageContent .= "<option value='$skill'>$skill ($total)</option>";
}

Can you help me understand what the difference is between the two methods? It looks like the accomplish the same thing.

Thank you.

With do…while(), first it is executed the code from do{…} then the condition from while(). So, in that case, the $row variable used in do{…} not exists for the first iteration because it is created after the while() condition is executed.