Forum Moderators: coopster
I have two fields in my table (brand and type). The following query displays results based on brand (which is perfect). However, I ALSO need the query to organize the results by type, not by brand. IOW, a brand is selected and the data that is returned is based upon this selected brand but is ordered into the two different types (i.e. all of the brand data pertinent to Type 1 is displayed first and all of the brand data pertinent to Type 2 is displayed second). Can someone tell me what I am missing from the following query to make this happen?
<select name="brand_id" onchange="go(this);">
<option value=""></option>
<?
$sql = "SELECT brand_id, brand FROM cart_brand ORDER BY brand";
$result = mysql_query($sql, $db);
while($row = mysql_fetch_assoc($result)) {
echo " <option value=\"content_update.php?brand=".$row['brand_id']."\">".stripslashes($row['brand'])."</option>\n";
}
mysql_free_result($result);
?>
</select>
Maybe I could put in a second query that would enable the user to choose between Type 1 and Type 2 (similar to the query ran above to choose the brand) but the answer that the query returns (i.e. by sorting based on Type 1 or Type 2) would have to still be contained within the previously-chosen brand?