I have a column in my database called ‘category’ that contains the name of the individual category that each blog post is in (‘cars’,’books’,’movies’).
I need to create a list that contains each of these categories.
When I query the database and echo all my categories I get a list with many duplicates (as expected).
Example:
- books
- books
- books
- cars
- movies
- movies
But what if I just want to display each individual category. How is this done? Can somebody point me to an online resource for this.
example:
- books
- cars
- movies
Use the
DISTINCTkeyword: