witham Posted August 14, 2006 Share Posted August 14, 2006 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? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 14, 2006 Share Posted August 14, 2006 http://uk.php.net/array_unique Quote Link to comment Share on other sites More sharing options...
witham Posted August 14, 2006 Author Share Posted August 14, 2006 thanks very much, thought there must be one cheers!! Quote Link to comment Share on other sites More sharing options...
witham Posted August 14, 2006 Author Share Posted August 14, 2006 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 executedecho '<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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.