{% for i in coupontesting %}
<center>
<div class="rectangle">
<span class="right">Store Link</span><span class="left">{{ i.seller_store }}</span>
<div class="coupon-frame">
<div class="coupon-left-div coupon-align-center">
<div style="padding: 1.125rem;border-left: 1px solid #d4d4d4;">
<div style="position:relative;">
<div class="coupon-left-img-div text-center coupon-align-center orange pt-32">
<span class="bold-18">{{ i.name }}</span>
</div>
</div>
</div>
<div class="coupon-ticket-frame">
<div class="coupon-ticket-frame-style">
<div class="oupon-ticket-frame-line"></div>
</div>
</div>
</div>
<div class="coupon-right-div coupon-align-center">
{{ i.coupon_code }}
</div>
<div class="coupon-right-div coupon-align-center">
<button> Use Now </button>
</div>
</div>
<br><br>
</div>
</center>
{% endfor %}
Above is the view page
Below is my query from Model Page
$query = $this->db->query("SELECT * FROM coupon c INNER JOIN coupon_customer cc ON c.coupon_id = cc.coupon_id LEFT JOIN coupon_store cs ON c.coupon_id = cs.seller_store_id LEFT JOIN seller_store ss ON c.seller_store_id = ss.seller_store_id WHERE cc.customer_id = $customer_id AND c.date_end > NOW() ");
if ($query->num_rows) {
return $query->rows;
} else {
return 0;
}
Table Structure
Table: coupon
coupon_id name coupon_code date_start date_end
Table: coupon_customer
coupon_id customer_id
Table: coupon_store
coupon_store_id coupon_id seller_store_id
Table: seller_store
seller_store_id seller_store_name seller_id
Everything works fine , but i wanted to ask is there anyway to "grouping the same seller store together ?
Image : https://prnt.sc/rnjbbf (Result from my code)
What i wanted: https://prnt.sc/rnjbqs
Any idea that how to do nested array ? have problem to change my result into nested array