thinkphp My order 1 order number corresponds to multiple items

Source: Internet
Author: User
To achieve:





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 order



Course Information
Video Duration
Unit Price
Order Amount
Order Status

Operation




<{$order .ordertime}> Order Number: <{$order .number}>

















"alt=" picture description "/><{$list .course_name}>

Teaching Teacher:

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

Validity:

<{$list .valid}>




<{$list .lessontime}> min ¥<{$list .course_price}> ¥<{$order .amount}> Unpaid paid Delete Immediate Payment





Reply to discussion (solution)

Front-end traversal data issues

Order Form Association Order Product table

Order_info and Order_goods
Draw a result set, traverse the loop

Order Form Association Order Product table

Order_info and Order_goods
Draw a result set, traverse the loop




I've come to the result set is the front-end traversal problem is a table how to play?

You can calculate the number of order item items and then merge the cells.

I have got out, gave up table, with Div platoon, now no problem,, points or points to everyone,

  • Related Article

    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.