I have 2 tables; t_item and t_type. t_item has no reference to t_type however t_type consists of type_id, item_id, desc, and cost. An item can have more than 1 type so in t_type there may be 6 records all with the same item_id. I need to query and retrieve this information. Currently, I am using the code listed below, however, I believe it is incorrect and would like a shove in the right direction on the best way to resolve it. I need to end up with an array that contains both the records from t_item and each items associated types. Thanks.
$item_results = array();
$result = mysql_query("select * from t_item", $pnp);
while($row = mysql_fetch_assoc($result)){
$item_results[] = $row;
$type_results = array();
$type_r = mysql_query("select * from t_type where item_id = " . $row['item_id]', $pnp);
while($row2 = mysql_fetch_assoc($type_r)) {
array_push($row2, $item_results);
}
}