Code: Select all
<select name="search_end_style">
<?php
$sqlselect_end_style = "SELECT DISTINCT end_style FROM products WHERE search_categories = 'IDLE CABLE' ORDER BY end_style";
$sqlresult_end_style = mysql_query($sqlselect_end_style);
$array_end_style = mysql_fetch_array($sqlresult_end_style);
while($array_end_style = mysql_fetch_array($sqlresult_end_style)){
$list_end_style = $array_end_style['end_style'];
$value_end_style = $array_end_style['end_style'];
$option_end_style = "<option value=".$value_end_style.">".$list_end_style."</option></br>";
print $option_end_style;
}
?>
</select>Also, If I remove the WHERE clause, I get all of the records in the column, however I do need to leave the where clause there.
If I sort the order different ways (ASC, DESC) I get a different set of results. There are only 2 values in the 'end_style'. If I sort by ASC I get one value. If I sort by DESC I get the other value.
I appears that my PHP script is not making the full query, like it is being cut off half way through and returning the first half of the results. Is there a reason for this in my code? Or possibly the php.ini file?
Can I remove DISTINCT from the query and remove the duplicate values in PHP? Doing this would solve my problem. I have tried to use array_unique(), but I cannot get it to work.