#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    3
    Rep Power
    0
    Hi,
    I've got a table with a field categories. Say there is a 100 records and there is 30 categories.
    I want to include the categories in a select menu, but do not want the options to be duplicated. Someone suggested I use the in_array() function, but I'm at a loss how to do it.
    Please help!
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,645
    Rep Power
    4492
    SELECT DISTINCT categories FROM your_table;

    That will give you everything without the duplicates.

    ---John Holmes...

    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions...
    *
    * PHP Manual. www.php.net/manual
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter
    *************************************************************

IMN logo majestic logo threadwatch logo seochat tools logo