jaxdevil Posted June 7, 2008 Share Posted June 7, 2008 ok, I am trying to select distinct column data. I.e. I have in my database many columns and one of the columns is 'man' (for manufacturers) I am trying to pull a query that will return all the unique manufacturer entries. Say I have 'Nike' and 'Reebok' and 'Whatever'. And I have Nike 60 times, Rebook 12 times, and Whatever 2 times. I want it to return just 1 Nike, 1 Reebok and 1 Whatever. Below is the code I am using, obviously it is not working. Who knows what to do here? I appreciate it... <?php require($_SERVER['DOCUMENT_ROOT'] . "/config.inc.api.php"); ?> <?php $sql = "SELECT DISTINCT `man` FROM products LIMIT 5"; $query = mysql_query($sql); while ($row = mysql_fetch_array($query)) { echo '<li onClick="fill(\''.$row['man'].'\');">'.$row['man'].'</li>'; } ?> Link to comment https://forums.phpfreaks.com/topic/109180-solved-selecting-a-distinct-db-column-fields/ Share on other sites More sharing options...
jaxdevil Posted June 7, 2008 Author Share Posted June 7, 2008 never mind, I got it. I wasn't putting in a query string to look for. My bad Link to comment https://forums.phpfreaks.com/topic/109180-solved-selecting-a-distinct-db-column-fields/#findComment-560051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.