Result i want:
campaign 1
offer 1.1
offer 1.2
offer 1.3
(and so forth)
campaign 2
offer 2.1
offer 2.2
offer 2.3
(and so forth)
These are my tables:
campaign (tablename)
campaign_id (used)
campaign_name
offer (tablename)
offer_id
offer_parentid (uses category_id find which category the item is supposed to be paired
with.)
offer_name
i have little experience with using two tables but i find it useful for this kind of thing. my problem is i've tried every aspect of php i know, and i can't get the results i want. this is my final result after several hours of blood, sweat and tears:
$get_campaign = mysql_query("SELECT * FROM campaign ORDER BY campaign_id DESC")
or die(mysql_error());
$get_offers = mysql_query("SELECT * FROM offers JOIN campaign ON offers.offer_parentid=campaign.campaign_id ORDER BY campaign_id DESC ")
or die(mysql_error());
while($row = mysql_fetch_array($get_campaign)){
echo $row['campaign_name']."</br>";
while($row = mysql_fetch_assoc($get_offers)){
echo $row['offer_name']."</br>";
}
}
the result becomes:
Campaign 1
offer 1.1
offer 1.2
offer 2.1
offer 2.2
campaign 2
Thanks for any help i can get