a litle help with SQL query and PHP

Discussion in 'PHP' started by Kyriakos, Nov 27, 2008.

  1. #1
    hi everyone,

    i have an SQL query where i'm selecting the manufacturers of my products. i want to create a "filter" where the visitors can separate the products by manufacturer that his want. this is my PHP code:
    <?php $msql = mysql_query("SELECT manuf FROM products WHere cid='$cid' AND status=1 ORDER BY manuf");
    	  while($mrow = mysql_fetch_array($msql)) {?>
          <a href="<?php echo "products.php?cid=".$cid."&manuf=".$mrow['manuf'];?>"><?php echo $mrow['manuf'];?></a><br><?php }?>
    PHP:
    My output from this SQL is this:
    but i want to display one manufacturer for each similar rows. like that:
    can anybody help me whith this?
     
    Kyriakos, Nov 27, 2008 IP
  2. wootty

    wootty Peon

    Messages:
    447
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try "select distinct manuf..." - that might do waht you want.....
     
    wootty, Nov 27, 2008 IP
  3. Kyriakos

    Kyriakos Active Member

    Messages:
    155
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    thank you. it's working fine.
     
    Kyriakos, Nov 27, 2008 IP