Retrive data from Database through dataprovider

i have two tables named Order and Cart,

and having the data like this.





note:"userid" in "Order" table have index on "User" table "id"



| 25–|--2----|–Done-------|-255–|—25----|

| 25–|--2----|–Done-------|-255–|—655—|

| 25–|--2----|–Done-------|-255–|—65----|

| 25–|--3----|–Done-------|-255–|—254—|

note:"orderid" in "Cart" table have index on "Order" table "id"

 "productid" in "Cart" table have index on "Product" table "id"

i want to show the order history based on user login.

i’m tried with CArrayDataProvider with CListiview, it become challenging to get data from database.

Please Help me anyway to get the data from database.