Skip to main content
Participant
May 15, 2009
Question

Dynamic List/Menu help

  • May 15, 2009
  • 1 reply
  • 468 views

Trying to build a database search form, (php Mysql) everything ok until I created a dynamic List/Menu using the DW (CS4) wizard. I'm getting duplicates in my results. How do I stop duplicates and get uniques instead. Here's the code. Someone please help....

select nalemme="select2" id="select2">
      <option value="">Country</option>
      <?php
do { 
?>
      <option value="<?php echo $row_associations['Site_ID']?>"><?php echo $row_associations['Bcode_Community']?></option>
      <?php
} while ($row_associations = mysql_fetch_assoc($associations));
  $rows = mysql_num_rows($associations);
  if($rows > 0) {
      mysql_data_seek($associations, 0);
      $row_associations = mysql_fetch_assoc($associations);
  }
?>
    </select>

This topic has been closed for replies.

1 reply

David_Powers
Inspiring
May 15, 2009

How do I stop duplicates and get uniques instead.

Use your SQL query to select only unique values:

SELECT DISTINCT thisColumn

FROM myTable

Participant
May 15, 2009

Thanks, I had thought of this and tried it but must have got my syntax  wrong as it didn't work. Now I know i'm on the right track I'll try again.