Friday, 15 July 2011

php - List brand only once from table -



php - List brand only once from table -

i have table of products. each product has field 'brand'

i need list brands on page, more 1 product can have same brand. how list brand once? soi 5 products have same brand name im not getting brand name 5 times.

$data=mysqli_query($link, "select brand products"); while($info=mysqli_fetch_array($data)){ $output .= '<div class="brands">'; $output .=$info["brand"]; $output.='</div>';

this outputs every instance of brand

thanks

select distinct brand products

this should work.

php mysql

No comments:

Post a Comment