In the second fetch the array is already fetched so the 'cursor' is in the end of the result set. In order to fetch the same array again, you need to go to the beginning.
Try adding
if (!mysql_data_seek($result, 0)) {
echo "Seek failed: " . mysql_error();
}
after the first fetch.