I have 2 tables
Packackage
id,name
I have a plans table
id,package_id,plan,amount,duration
I want to display the package name then below that have it show the plan name,amount and duration that goes with that package name
EX I have packages called Alpha,Beta
I then have 3 plans in plan table and 2 of them have the id of the Alpha package and other with the Beta.
It should come out like this
Alpha
Plan 1 ect...
plan 2 ect
Beta
Plan 1 ect
What I have so far is listed below.
Code: Select all
<table width="396">
<?php $q=mysql_query("Select * from packages")or die (mysql_error());
while($pack=mysql_fetch_array($q,MYSQL_ASSOC)) {
$r=mysql_query("select * from plans")or die(mysql_error());
while($plan=mysql_fetch_array($q,MYSQL_ASSOC)) {
echo'<tr> <td>'.$pack['plan_name'].'</td></tr>
<tr><td>'.$plan['name'].'</td><td>'.$plan['amount'].'</td><td>'.$plan['rate'].'</td><td>'.$plan['length'].'</td></tr>';
}
}
?>
</table>Thanks