Here's my idea:

// select all products made by the manufacturer
$query="SELECT DISTINCT Name, Prod_ID FROM Product WHERE In_Stock = 1
and Man_ID = '$Man_ID'";
$mysql_result=mysql_query($query, $mysql_link);
// loop through the results
    // determine whether the product is in the current category
    $query2="SELECT * FROM Product_Category WHERE Prod_ID = '$row[1]'
and Cat_ID = '$Cat_ID'";
    $mysql_result2=mysql_query($query2, $mysql_link);
    // if it is in category, add it to one list
    if(mysql_num_rows($mysql_result2) != 0){
        $ThisCatList .= "$row[0]<br />\n";
    // if it isn't in category, add it to second list
        $OtherCatList .= "$row[0]<br />\n";
// display list from this category
// display list from other categories

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to