Richie,
When you call mysql_fetch_xxx() it automatically shifts the internal data point in the query result ahead by one record each time the function is called. Therefore, you code is not printing the first record because you called it to verify that a record set was returned. There are a couple of ways to fix this.
First.... change:
$row = mysql_fetch_array($result);
if ($row[user_name] == $user_name) {
to:
if (is_resource($result)) {
Second........ place the following line beteen the open if() and open while():
@mysql_data_seek($result, 0);
This resets the data pointer to the first record in the returned set. HTH.
geoff