How to list Dynamic categories

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ibec
    New Member
    • Jun 2008
    • 2

    How to list Dynamic categories

    Hi I'm new to the forum and MySQL and PHP. I hope you'll excuse the simple question.
    Here's my problem: On our website I'm trying to put together a dynamic collection of links that will be presented on one page. For the database table, I've created the following columns:
    id, category, link_name, http, description

    My problem is that when I present the links, I want to group them by their category and have the category name as the section title. But I don't want to be limited by preset categories. I want the admin to be able to create as many categories as they want and the links page dynamically respond to it.

    So... how do I get MySQL to tell me:
    a- How many categories there are within a column
    b- and what they are

    Thank you in advance for your help.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by ibec
    ...
    a- How many categories there are within a column
    b- and what they are

    Thank you in advance for your help.
    [CODE=mysql]select distinct(catego ry) from tableName[/CODE] ?

    Comment

    • ibec
      New Member
      • Jun 2008
      • 2

      #3
      Wow, works like a charm. Thank you.

      Comment

      Working...