While loop display only certain rows in array?

I’m woefully lacking on manipulating arrays. Hope you guys can help. Here’s the issue I’ve run into…I’m querying a MySQl database for a list of attorneys for a law firm. Returned in the query are id, name, title, location, phone number. Currently, I’m simply using a while loop to cycle through each row and create/populate an HTML table with the results.


    $i = 0;
    while($result_ar = mysql_fetch_assoc($result)){
    
     echo '<tr ';
     if($i%2 == 1){ echo "class='searchresults1'"; }else{echo "class='searchresults2'";} echo 'align="left" valign="middle">';
        echo '<td width="25%"><a href="bio.php?id='. $result_ar['attorney_id'].'">'.$result_ar['name'].'</a></td>';
        echo '<td width="25%">'.$result_ar['title'].'</td>';
        echo '<td width="25%">'.$result_ar['location'].'</td>';
        echo '<td width="25%">'.$result_ar['phone'].'</td>';
        echo '</tr>';
        $i+=1;
             } ?>

Now my client wants me to separate the results under a different heading for each title (There’s only two possible titles: Shareholder and Associate) rather than just list the title next to the name. So it would now look like:

Shareholders:
Attorney Name1 Location Phone
Attorney Name3 Location Phone

Associates:
Attorney Name2 Location Phone
Attorney Name4 Location Phone
Attorney Name5 Location Phone

What’s the best way to do this? Can it be done with one query and using PHP to loop through and print only the rows with a title value of Shareholder in one table and a value of Associate in the other?

Or do I just need to do 2 queries (1 for Shareholders and one for Associates)?

Thanks in advance!

rvt