From the manual:mysql_fetch_array
Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.
So the first time you call this
$row = mysql_fetch_array($result);
if(!$row) {
you are getting the first row. and the second time you call it, you are getting the second row.