Thinkphp my order 1 order number corresponds to multiple items

Source: Internet
Author: User
Thinkphp what I want to achieve when one order number corresponds to multiple items:





Thinkphp code:
Public function myorder (){
$ Obj = M ();
$ SQL = "select GROUP_CONCAT (oc. courseList_id order by oc. courseList_id DESC) AS courseList, o. order_id, o. user_id, o. user_name, o. number, o. orderTime, o. status, o. amount, oc. courseList_id from tb_order as o inner join tb_order_courselist as oc on o. order_id = oc. order_id where o. user_id = ". $ _ SESSION ['User _ id']. "group by o. order_id order by o. order_id desc ";
$ OrderData = $ obj-> query ($ SQL );
Foreach ($ orderData as $ value ){
$ SQL _list = "select * from tb_order_courseList where courseList_id in (". $ value ['courselist']. ")";
$ Course_list = $ obj-> query ($ SQL _list );

}

$ This-> assign ("courseList", $ course_list );
$ This-> assign ("orderData", $ orderData );
$ This-> display ();
}

Template code:


My orders

Course Information
Video duration
Unit Price
Order amount
Order Status

Operation





<{$ Order. orderTime}> order No:<{$ Order. number}>


















"Alt =" Image description "/><{$ List. course_name}>


Instructor:

<{$ List. teacher_names | mb_substr = 0, 5, 'utf-8'}>

Validity period:

<{$ List. valid}>




<{$ List. lessonTime}> minutes ¥ <{$ List. course_price}> ¥ <{$ Order. amount}> Unpaid Paid Delete payment now





Reply to discussion (solution)

Frontend data traversal

Order table associated with order Product Table

Order_info and order_goods
Returns the result set and traverses the loop.

Order table associated with order Product Table

Order_info and order_goods
Returns the result set and traverses the loop.




I have come to the conclusion that the result set is frontend traversal. a problem occurs. how can this problem be solved?

You can calculate the number of order item entries and then merge cells and so on.

I have already made it out. I gave up the table and used DIV to arrange it. now it's okay. I 'd like to share it with you,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.