Well I got it working correctly. Only one things that it does strange is that it re-displays each category group as many times as there our records. So if theres 20 products under a certain brand it will display the Brand title list out the products underneath correctly but will then loop through nineteen more times displaying that brand list over and over.
Here's the code:
$query = "select * from table WHERE brand='Panasonic';";
$result = mysql_query($query) or die(mysql_error());
$query1 = "select * from table WHERE brand='Xerox';";
$result1 = mysql_query($query1) or die(mysql_error());
$query2 = "select * from table WHERE brand='Riso';";
$result2 = mysql_query($query2) or die(mysql_error());
$query3 = "select * from table WHERE brand='Kyocera';";
$result3 = mysql_query($query3) or die(mysql_error());
$query4 = "select * from table WHERE brand='Panafax';";
$result4 = mysql_query($query4) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
echo ("<option></OPTION>");
echo ("<OPTION>");
echo $row["brand"];
echo ("</OPTION>");
echo ("<option>----------------------------</OPTION>");
$query0_0 = "select product_id,product from table WHERE brand='Panasonic';";
$result0_0 = mysql_query($query0_0) or die(mysql_error());
while ($row = mysql_fetch_array($result0_0))
{
echo ("<OPTION VALUE=showresults.php?make=".urlencode($row["product_id"]).">");
echo $row["product"];
echo ("</OPTION>");
}
echo "<br>";
}
while ($row = mysql_fetch_array($result1))
{
echo ("<option></OPTION>");
echo ("<OPTION>");
echo $row["brand"];
echo ("</OPTION>");
echo ("<option>----------------------------</OPTION>");
$query1_1 = "select product_id,product from table WHERE brand='Xerox';";
$result1_1 = mysql_query($query1_1) or die(mysql_error());
while ($row = mysql_fetch_array($result1_1))
{
echo ("<OPTION VALUE=showresults.php?make=".urlencode($row["product_id"]).">");
echo $row["product"];
echo ("</OPTION>");
}
echo "<br>";
}
while ($row = mysql_fetch_array($result2))
{
echo ("<option></OPTION>");
echo ("<OPTION>");
echo $row["brand"];
echo ("</OPTION>");
echo ("<option>----------------------------</OPTION>");
$query2_2 = "select product_id,product from table WHERE brand='Riso';";
$result2_2 = mysql_query($query2_2) or die(mysql_error());
while ($row = mysql_fetch_array($result2_2))
{
echo ("<OPTION VALUE=showresults.php?make=".urlencode($row["product_id"]).">");
echo $row["product"];
echo ("</OPTION>");
}
echo "<br>";
}
while ($row = mysql_fetch_array($result3))
{
echo ("<option></OPTION>");
echo ("<OPTION>");
echo $row["brand"];
echo ("</OPTION>");
echo ("<option>----------------------------</OPTION>");
$query3_3 = "select product_id,product from table WHERE brand='Kyocera';";
$result3_3 = mysql_query($query3_3) or die(mysql_error());
while ($row = mysql_fetch_array($result3_3))
{
echo ("<OPTION VALUE=showresults.php?make=".urlencode($row["product_id"]).">");
echo $row["product"];
echo ("</OPTION>");
}
echo "<br>";
}
while ($row = mysql_fetch_array($result4))
{
echo ("<option></OPTION>");
echo ("<OPTION>");
echo $row["brand"];
echo ("</OPTION>");
echo ("<option>----------------------------</OPTION>");
$query4_4 = "select product_id,product from table WHERE brand='Panafax';";
$result4_4 = mysql_query($query4_4) or die(mysql_error());
while ($row = mysql_fetch_array($result4_4))
{
echo ("<OPTION VALUE=showresults.php?make=".urlencode($row["product_id"]).">");
echo $row["product"];
echo ("</OPTION>");
}
echo "<br>";
}