I noticed a small problem
// You have this...
if ($result && (mysql_numrows($result) > 0 ))
// ...and it should be...
if ($result && (mysql_num_rows($result) > 0 ))
And i would double check that the PHP page you spelled DISTINCT properly, I've been known to do that. And you have the code in a .doc file so it may have spelled corrected it for you. Maybe?
Good Luck