I know it's not PHP but it's somewhat related.
I'm using the following:
$qry = "SELECT DISTINCT `name` FROM `$parts_database_table`";
$result2 = mysql_query($qry, $connection);
$pumps = mysql_fetch_row($result2);
The problem is that I need to get the id field of those. I tried using DISTINCT name, id but all it got me was a huge headache. Please someone help :-(