Jump to content

sonicslp

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sonicslp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is my explanation too confusing? I'm really stumped here.
  2. I'm a bit of a newbie here, so I'll try to be thorough. TABLE: ProductGroupsLineItem Fields: ItemID_t, Group_t, SubGroup_t, Brand_t, Active_n Example data: CL2000, Braking, Control Arms, MyBrand, 1 CL3000, Braking, Braded Cables, MyBrand, 1 CL4000, Custom Gauges, Blue, MyBrand, 1 CL5000, Braking, Fluid, MyBrand, 1 Result I would like: Group_t = Braking Group_t = Custom Gauges I only have "SubGroup_t" when starting. First I find all "ItemID_t" that contain the correct "SubGroup_t" value. Then, I find all "Group_t" from that result. Ultimately, I just want to find every possible group from that result, but I only want to display one of each group. What I'm getting with the query below is: Group_t = Braking Group_t = Braking Group_t = Custom Guages Group_t = Braking I use "Group By" in other places and it works great, I assume it has something to do with the nested "while"? $r1 = mysql_query("SELECT ItemID_t FROM ProductGroupsLineItem WHERE Brand_t='$MFGNAME' AND SubGroup_t='$subgroup'"); while ($row1 = mysql_fetch_array($r1)) { $ItemID = $row1['ItemID_t']; $r2 = mysql_query("SELECT Group_t FROM ProductGroupsLineItem WHERE Brand_t='$MFGNAME' AND ItemID_t='$ItemID' AND Active_n='1' GROUP BY Group_t ORDER BY Group_t ASC") or die(mysql_error()); while ($row2 = mysql_fetch_array($r2)) { $groupGeneral = $row2['Group_t']; echo $groupGeneral; echo '<br />'; } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.