I have a table with 20 different plans.
plans.sql
id | planName
1 | Alpha
2 | Omega
3 | Gamma
...
Each plan contains 3 different levels (Bronze, Silver, Gold). I want to display all the plans on a page like this:
Alpha Alpha Alpha
Bronze Silver Gold
Omega Omega Omega
Bronze Silver Gold
...
So far I'm pulling the plan names from the database with a while loop as follow:
$plansql = "select * from plans";
$resultps = $conn->query($plansql);
$resultp = array();
if (mysqli_num_rows($resultps) > 0) {
while($plan = mysqli_fetch_assoc($resultps)) {
$resultp[] = '<div class="col-lg-2">
<div class="panel price panel-red">
<div class="panel-heading text-center">
<h3>'.$plan['planName'].'</h3>
<h3>'.$planLevel.'</h3>
</div>
<div class="panel-body text-center">
<p class="lead panel-body-pricing" style=""><strong>'.$plan['planPrice'].'</strong></p>
</div>
<ul class="list-group list-group-flush text-center">
<li class="list-group-item"><i class="icon-ok text-danger"></i>
This plan is perfect for...
</li>
</ul>
<div class="panel-footer">
<a class="btn btn-lg btn-block btn-danger" href="#">SEE DETAILS</a>
</div>
</div>
</div>';
}
}
I display the result outside the while loop
.join("",$resultp).
It works great, but how do I add the different levels to each plan?