怎样把订单号相同的信息合并起来呢,我该怎样改变数组结构呢?类似淘宝的订单
/**********定单基本信息表******************/
drop table if exists sh_order;
create table sh_order
(
id mediumint unsigned not null auto_increment,
order_sn char(16) not null comment '定单编号',
member_id mediumint unsigned not null comment '会员id',
addtime int unsigned not null comment '下单时间',
pay_status enum("是","否") not null default '否' comment '支付状态',
post_status enum("是","否") not null default '否' comment '发货状态',
total_price decimal(10,2) not null comment '总价',
postage decimal(10,2) not null comment '邮费',
pay_time int unsigned not null default '0' comment '付款时间',
pay_method enum("支付宝") not null default '支付宝' comment '支付方式',
post_method enum("顺风","圆通") not null comment '配送方式',
shr_name varchar(30) not null comment '收货人',
shr_province varchar(30) not null comment '收货人省',
shr_city varchar(30) not null comment '收货城市',
shr_area varchar(30) not null comment '收货地区',
shr_address varchar(150) not null comment '收货地址',
shr_postcode varchar(30) not null comment '收货邮编',
shr_mobile varchar(30) not null comment '收货人手机',
primary key (id),
key member_id(member_id),
key order_sn(order_sn),
key addtime(addtime)
)engine=InnoDB default charset=utf8 comment '定单基本信息表';
/****************订单商品表**************************/
drop table if exists sh_order_goods;
create table sh_order_goods
(
id mediumint unsigned not null auto_increment,
order_id mediumint unsigned not null comment '定单id',
goods_id mediumint unsigned not null comment '商品id',
goods_name varchar(60) not null comment '商品名称',
goods_attr_id varchar(150) not null default '' comment '商品属性id',
price decimal(10,2) not null comment '购买时的价格',
goods_number int unsigned not null comment '购买的数量',
primary key (id),
key order_id(order_id),
key goods_id(goods_id)
)engine=InnoDB default charset=utf8 comment '定单商品表';
/**************商品表*******************/
drop table if exists sh_goods;
create table sh_goods
(
id mediumint unsigned not null auto_increment,
sm_logo varchar(150) not null default '' comment 'logo的缩略图路径(150*150)',
logo varchar(150) not null default '' comment 'logo的路径',
sm_show_pic varchar(150) not null default '' comment '展示图的缩略图路径(150*150)',
show_pic varchar(150) not null default '' comment '展示图的原图路径',
goods_brand_id mediumint unsigned not null comment '商品品牌id',
goods_name varchar(60) not null comment '商品名称',
market_price decimal(10,2) not null comment '市场价',
shop_price decimal(10,2) not null comment '本店价',
is_on_sale enum('是','否') not null default '是' comment '是否上架',
goods_number mediumint unsigned not null default '0' comment '库存量',
type_id mediumint unsigned not null default '0' comment '类型id',
goods_desc text comment '商品描述',
order_num tinyint unsigned not null default '100' comment '排序数字',
addtime int unsigned not null comment '添加时间',
primary key (id),
key shop_price(shop_price),
key is_on_sale(is_on_sale),
key addtime(addtime),
key order_num(order_num)
)engine=MyISAM default charset=utf8 comment '商品';
/**************商品属性表************************/
drop table if exists sh_goods_attr;
create table sh_goods_attr
(
id mediumint unsigned not null auto_increment,
goods_id mediumint unsigned not null comment '商品id',
attr_id mediumint unsigned not null comment '属性id',
attr_value varchar(150) default '' not null comment '属性的值',
primary key (id),
key goods_id(goods_id),
key attr_id(attr_id)
)engine=MyISAM default charset=utf8 comment '商品属性';
// Model模型中,根据会员ID从数据库中取出会员自己的订单,
public function getOrder($mid)
{
$orderModel = M('Order');
$orderData = $orderModel->field('a.order_sn, a.addtime, a.shr_name,
c.goods_name, c.sm_logo, b.goods_number,
b.price, d.attr_value, a.postage, a.post_status')
->alias('a')->join('LEFT JOIN sh_order_goods b ON a.id = b.order_id')->
join('LEFT JOIN sh_goods c ON b.goods_id = c.id')->
join('LEFT JOIN sh_goods_attr d ON b.goods_attr_id = d.id')
->where('a.member_id='.$mid)->select();
}
//在Controller控制器用户中心里调用
public function center()
{
if(session('id'))
{
$mid = session('id');//session('id')就是会员ID
$memberModel = D('Member/Member');
$orderData = $memberModel->getOrder($mid);
$this->assign('orderData',$orderData);
}
else
{
redirect('login');
}
$this->display();
}
HTML页面中输出:
$v):?>
这个是显示出来的订单页面:

如何改为淘宝这样的呢?我该如何改变数组结构呢?

AD:真正免费,域名+虚机+企业邮箱=0元

了解Python编程的入门级代码示例Python是一种简单易学,功能强大的编程语言。对于初学者来说,了解Python编程的入门级代码示例是非常重要的。本文将为您提供一些具体的代码示例,帮助您快速入门。打印HelloWorldprint("HelloWorld")这是Python中最简单的代码示例。print()函数用于将指定的内容输出

PHP变量存储程序运行期间的值,对于构建动态且交互式的WEB应用程序至关重要。本文将深入探讨php变量,并通过10个真实的示例展示它们的实际应用。1.存储用户输入$username=$_POST["username"];$passWord=$_POST["password"];此示例从表单提交中提取用户名和密码,并将其存储在变量中以供进一步处理。2.设置配置值$database_host="localhost";$database_username="username";$database_pa

标题:从入门到精通:Go语言中常用数据结构的代码实现数据结构在编程中起着至关重要的作用,它是程序设计的基础。在Go语言中,有许多常用的数据结构,掌握这些数据结构的实现方式对于成为一名优秀的程序员至关重要。本文将介绍Go语言中常用的数据结构,并给出相应的代码示例,帮助读者从入门到精通这些数据结构。1.数组(Array)数组是一种基本的数据结构,是一组相同类型

如何使用PHP编写库存管理系统中的库存分仓管理功能代码库存管理是许多企业中不可或缺的一部分。对于拥有多个仓库的企业来说,库存分仓管理功能尤为重要。通过合理管理和跟踪库存,企业可以实现不同仓库之间的库存调拨,优化运营成本,改善协同效率。本文将介绍如何使用PHP编写库存分仓管理功能的代码,并为您提供相关的代码示例。一、建立数据库在开始编写库存分仓管理功能的代码之

Java冒泡排序最简单的代码示例冒泡排序是一种常见的排序算法,它的基本思想是通过相邻元素的比较和交换来将待排序序列逐步调整为有序序列。下面是一个简单的Java代码示例,演示了如何实现冒泡排序:publicclassBubbleSort{publicstaticvoidbubbleSort(int[]arr){int

《Go语言编程实例:Web开发中的代码示例》随着互联网的快速发展,Web开发已经成为各行业中必不可少的一部分。作为一门功能强大且性能优越的编程语言,Go语言在Web开发中越来越受到开发者们的青睐。本文将通过具体的代码示例,介绍如何利用Go语言进行Web开发,让读者能够更好地理解和运用Go语言来构建自己的Web应用。1.简单的HTTP服务器首先,让我们从一个

华为云边缘计算对接指南:Java代码示例快速实现接口随着物联网技术的快速发展和边缘计算的兴起,越来越多的企业开始关注边缘计算的应用。华为云提供了边缘计算服务,为企业提供了高可靠的计算资源和便捷的开发环境,使得边缘计算应用更加容易实现。本文将介绍如何通过Java代码快速实现华为云边缘计算的接口。首先,我们需要准备好开发环境。确保你已经安装了Java开发工具包(

Java选择排序法代码编写指南及示例选择排序是一种简单直观的排序算法,其思想是每次从未排序的元素中选择最小(或最大)的元素进行交换,直到所有元素排序完成。本文将提供选择排序的代码编写指南,并附上具体的Java示例代码。算法原理选择排序的基本原理是将待排序数组分为已排序和未排序两部分,每次从未排序部分选择最小(或最大)的元素,将其放到已排序部分的末尾。重复上述


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

Atom编辑器mac版下载
最流行的的开源编辑器