Jump to content

Archived

This topic is now archived and is closed to further replies.

witham

searching arrays

Recommended Posts

Can anyone please tell me if there is a way to search an array but only display unique entries even though duplicates may be there?

Share this post


Link to post
Share on other sites
I am a little confused as to where to put the array_unique, could you help please:


[code]<tr><td><b>Product Name:</b></td>

<!--put the query $sqlPRODNAME into the $result variable or display error if query fails-->

<?


$result  = mysql_query($sqlPRODNAME, $dblink)
or die("<p>Error Processing Query</p><hr /><p>".mysql_error()."</p>\n");


// mysql_fetch_array fetches the results from the query a row at a time and populates the drop down box each time it's called
// the result is returned as an array that can be referenced either by field name or by it's index, "ALL" is hardcoded because
//it is always constant and allows the % query to be executed


echo '<td><select name="Equivalent">';
echo '<option value = "%"><b>ALL';

while ($row = mysql_fetch_array ($result))



// loop through the rows outputing them as select options
  {
echo '<option value="' . $row["PRODEQUIV"] . '">' . $row["PRODEQUIV"] . "</option>";
  }
?>
</select></td></tr>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.