In my database the table is set out like this:
id | title | category
There is about 1000 records in there and i want to be able to create a list of the categories but if i do a foreach statement i just get the same categories over and over.
$select = "SELECT subcategory FROM recipes WHERE category = '" . $row['category'] . "' GROUP BY subcategory"; don't do this in php, use a mysql query. Code:
SELECT DISTINCT ( category ) FROM mytable OR Code:
SELECT category FROM mytable GROUP BY category
Leave a Reply
You must be logged in to post a comment.