Output display repeatedly

Hi, I need some help please,why is it that my $rmx is displaying repeatedly.even it is not matched to the $s_id ?


    $command=$db->prepare('SELECT * from employee where id = ?');
    $command->execute(array($empid));


 while($record=  $command->fetch(PDO::FETCH_ASSOC)){
            $s_id = $record['s_id'];
			   	
		          $cmmmand2 = $db->prepare("SELECT * from office where off_id = ?");
			   $command2->execute(array($s_id));
			
			  while($record2 = $command2->fetch(PDO::FETCH_ASSOC)){
				    $rmx.=$record2['off_server'].'<br/>';
			
			  }		
				
            $data.= '<div class="myoffice"><p>'.$record['office_name'].'<br/>'.$rmx.'</div>';
			
			
        }



The output is like this.it continues to display in my A02rm


A01rm
server1
server2


A02rm
server1
server2
server3
server4


I want that the output should like this.


A01rm
server1
server2


A02rm
server3
server4


Please help me on this.

Thank you in advance.

Sorry for my post…I think i solved it now…

No need to apologize for posting but you should post the solution for everyone else to learn from. I see the required solution as being that $rmx needs to be initialized in the outer loop.