If there are duplicate lastnames in the select there must be duplicate names in the database.. The best solution might be making a better databse structure where duplicate names won't occure.
You could also write a function that checks if you have already entered that name into the select
while($thearray = mysql_fetch_array($result))
{
$curname = $thearray[lastname];
if(!$written[$curname])
{
$written[$curname] = 1;
//output select
}
}
Andreas Bernhardsen
Graficonn