What do you mean it repeats it? That should iterate the resultset once and only once (
while($row=mysql_fetch_array($result)) is what does that and there is no re-assignment of $row or reset of $result).
If you are seeing multiple records of the same data, that would likely be the results of a joined query which appears to replicate when it finds multiple matches on joins. You can fix that by using a DISTINCT query.
header('HTTP/1.1 420 Enhance Your Calm');