1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
$sql_a = "SELECT * FROM $table_products WHERE products_cat=".$_POST["categories"]." ORDER BY products_brand ASC, products_id ASC";
$res_a = mysql_query($sql_a);
while($data_a = mysql_fetch_assoc($res_a))
{
echo "<option> ".$data_a["products_brand"]."</option>";
$sql_b = "SELECT * FROM $table_products WHERE products_cat=".$_POST["categories"].", products_brand=".$data_a['products_brand']." ORDER BY products_model ASC, products_id ASC";
$res_b = mysql_query($sql_b);
while($data_b = mysql_fetch_assoc($res_b))
{
echo "<option value='".$data_b["products_id"]."'> ".$data_b["products_model"]."</option>";
}
} |