I have a table like this: ------------------------------------------------------------------------------------ - product_id - mark_name - category_name - ------------------------------------------------------------------------------------ - 1 - aaa - catg 1 - - 2 - bbb - catg 2 - - 3 - aaa - catg 1 - - 4 - ddd - catg 1 - - 5 - bbb - catg 2 - ------------------------------------------------------------------------------------ and so on
I want to show all the mark_name in a category only once (if they more than once) I have this code: ...... $sql = "SELECT * FROM products, category WHERE category.name_category=products.name_category and category_id=".$_GET['category_id'] ; $rezultat = mysql_query($sql); while ($row=mysql_fetch_array($rezultat)) { echo "<b>Name:</b> ".$row["mark_name"]."<br>\n"; } .......... When i choose the category catg 1 the result is Name: aaa Name: aaa Name: ddd As you can see the name aaa appears 2 times insted 1. How to make the result look like this: Name: aaa Name: ddd