Forum Moderators: mack
Need a bit of help figuring this one out.
I have a table in a database and one column is named "Type"
I want to look at all the "Types" and print out only ONE of each type in a dyanmic list.
ie:
-------
¦ Type ¦
-------
¦ Car ¦
-------
¦ Car ¦
-------
¦ Truck ¦
-------
¦ Car ¦
-------
Then the list would look like:
Car
Truck
I can figure out the PHP to make the list, just not sure what the query and subsquent code to get the list values out.
Does that make sense? Can anyone help me out with this one?
Thanks!
Mike
Thanks for the response.
I tried that, but I don't think its working...heres a more specific example.
My Table is a list of Vendors with the usual information (Name Address Etc.)
The VENDORTYPE Column is currently populated with the types AUDIO and and VIDEO but as the database grows there may be more entries.
When I used your script:
$result = mysql_query("SELECT DISTINCT VENDORTYPE FROM VENDOR ORDER BY VENDORTYPE");
$types = mysql_fetch_array($result);
print_r ($types);
I expected Array ([0] = > Audio [1] = > Video)
what I got was:
Array ([0] => Audio [VENDORTYPE] = > Audio)
The video portion never showed up at all....what am I missing?
Appreciate the help very much!
Mike