Displaying a Query in a Pulldown Menu + More Advanced filter

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
amdorsey
Forum Newbie
Posts: 19
Joined: Mon Dec 06, 2004 2:46 pm

Displaying a Query in a Pulldown Menu + More Advanced filter

Post by amdorsey »

I have a pulldown menu being dynamically populated by a database

Code: Select all

<option value="">Choose a Beginning Date</option>
      <?php
do &#123;  
?>
      <option value="<?php echo $row_Date_Sorter&#1111;'event']?>"><?php echo $row_Date_Sorter&#1111;'event']?></option>
      <?php
&#125; while ($row_Date_Sorter = mysql_fetch_assoc($Date_Sorter));
  $rows = mysql_num_rows($Date_Sorter);
  if($rows > 0) &#123;
      mysql_data_seek($Date_Sorter, 0);
	  $row_Date_Sorter = mysql_fetch_assoc($Date_Sorter);
  &#125;
?>
    </select>
I want to be able to just display unique values (hard to explain)

Basically, if I have a column "event" and in that "event" column I have the following values (christmas, thanksgiving, easter, christmas, easter)

In the pulldown I want to display...

Christmas
Easter
Thanksgiving

NOT -->

Christmas
Thanksgiving
Easter
Christmas
Easter

So, I need to filter out duplicate names for the "event" field, So when I make a selection from the pulldown, it sorts the database based on that event.

Hope this makes sense geniouses. You guys have answered questions Macromedia can't answer! Lets see about this one! haha.

Thanks All,
Adam[/php_man]
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

lot of research to do :p

lookup what the unique function does in the select clause...
lookup what the order clause does...
meaby lookup what the groupby clause does...
Post Reply