Basically I'm trying to get a single row for each item in table 1. In table 2 I have the corrosponding Key plus two other fields which may be in table 2 more than once. So what I have is a row for every time the key is in table 2 instead of just in table 1.
Example
Table 1
Key | Other Field 1 | Other Field 2 | Other Field 3
111 | Stuff | Stuff | Stuff
222 | Stuff | Stuff | Stuff
333 | Stuff | Stuff | Stuff
Table 2
Key | Other Field 4 | Other Field 5
111 | Info | More Info
111 | Info | More Info
111 | Info | More Info
222 | Diffrent Info | Still More Info
222 | Diffrent Info | Still More Info
With the way the the query is now
query("SELECT DISTINCT * FROM `Product` as t1 JOIN `Price` as t2 ON (t1.Item_Num=t2.Item_Num) WHERE Cat_Index = '$cat' AND Sub_Cat = '$cat3'")
When I loop through and display the information per the example above I get
5 rows
What I want to get is
2 rows
In the last column of each row have a drop down box that list OtherField4 and OtherField5 with the corrosponding Key fields.
Below is how I list the information thus far which results in the recurring info
//query product table and price table
$query2 = mysql_query("SELECT DISTINCT * FROM `Product` as t1 JOIN `Price` as t2 ON (t1.Item_Num=t2.Item_Num) WHERE Cat_Index = '$cat' AND Sub_Cat = '$cat3'");
while ($row = @mysql_fetch_array($query2))
{
$variable1=$row["Pic"];
$variable2=$row["Item_Num"];
$variable3=$row["Name"];
$variable4=$row["Short_Des"];
$variable5=$row["Desc"];
$variable6=$row["Price"];
//table layout for results
print ("<tr align=\"center\">");
print ("<td><img src=\"images/products/$variable1.jpg\" height=\"64\" width=\"64\"></td>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("<td>$variable4</td>");
print ("<td>$variable5 $variable6</td>");
print ("</tr>");
}
//end
?>
Any help is greatly appreciated.