Map Grid Help

I tried adding the while loop in the function below, but when i view the page, it just sits there and times out.


//Function to display the map.
function DisplayGrid($grid_x,$grid_y) {
    global $x, $y, $user_location, $users_map;
    
        $bgimg = 'grass.gif';
        $building = '';

        //Display current user location on the displayable grid if exists.
        if ($grid_x == $user_location['x'] &&  $grid_y == $user_location['y']) {
             $building = '<img src="images/map/building.gif" alt="" border="0" /><br />';
             $user_map_name = '<br /><a href="player_profile.php?id='.$user_location['uID'].'" target="_blank"><u><b>'.$user_location['uLogin'].'</b></u></a><br />';
        }

        //Fetch all player locations within the displayable grid.
        while($users_map = mysql_fetch_array(mysql_query("SELECT * FROM map LEFT JOIN users ON map.uID=users.uID WHERE map.x=$grid_x AND map.y=$grid_y"))){
            $building = '<img src="images/map/building.gif" alt="" border="0" /><br />';
            $user_map_name = '<br /><a href="player_profile.php?id='.$users_map['uID'].'" target="_blank"><u><b>'.$users_map['uLogin'].'</b></u></a><br />';
        }
    
    echo "<td width=\\"75\\" height=\\"75\\" style=\\"background-image: url('images/map/$bgimg');background-repeat: repeat;\\" align=center valign=center onclick=\\"window.location.href='map.php?xcord=$grid_x&ycord=$grid_y'\\">$building $user_map_name</td>";
}