i have table like this,
table name:product
cart id product_name
1 fan
2 tv
2 laptop
3 mobile
3 charger
3 earphone
i need to display
cart id=1
product name
fan
cart_id=2
product name
tv
laptop
cart_id=3
product name
mobile
charger
earphone
how to get this result??
there is no need for sql joins, i'm fetching all data from object using for each loop, but i'm confused how to put condition to get this result?
here cart id will be dynamic mean it will be incremented as per user create cart in their account with different products.