当前位置:网站首页>Three level classification display
Three level classification display
2022-06-11 13:27:00 【Mr Fu f】
Show the effect : Pictured
Code up It's using Yii frame
/** isdelete Deleted status 1: For display pid = 0 It's level one status = 1 It is opened for Zhejiang state */
$sql = 'select * from {
{ The name of the classified table }} where eid = 1231 and isdelete = 1 and pid = 0 and status = 1 ';
$res = Yii::app()->db->createCommand($sql)->queryAll();
foreach ($res as $k => $v) {
// Define an empty array as the name of the secondary classification
$res[$k]['child'] = [];
// Query secondary categories . Condition as father id Equal to the classification of grades id
$sql1 = 'select * from {
{ The name of the classified table }} where eid = 1231 and isdelete = 1 and pid = '.$v['id'].' and status = 1 ';
$res1 = Yii::app()->db->createCommand($sql1)->queryAll();
foreach ($res1 as $k1 => $v1) {
// Merge the query results into the defined array , Merge primary and secondary classifications
array_push($res[$k]['child'], $v1);
// Then define an array as the name of the three-level classification
$res[$k]['child'][$k1]['chlid2'] = [];
// Get the information of three-level classification
$sql2 = 'select * from {
{ The name of the classified table }} where eid = 1231 and isdelete = 1 and pid = '.$v1['id'].' and status = 1 ';
$res2 = Yii::app()->db->createCommand($sql2)->queryAll();
foreach ($res2 as $v2) {
// Merge primary, secondary and tertiary classifications
array_push($res[$k]['child'][$k1]['chlid2'], $v2);
}
}
}
边栏推荐
- 常用字体介绍
- 全球手机市场衰退,连苹果也对iPhone14不抱过高期待
- 马斯克称自己不喜欢做CEO,更想做技术和设计;吴恩达的《机器学习》课程即将关闭注册|极客头条...
- 不谈赛道,不聊风口,开源数据库巨头Cassandra如何在国内讲好“新故事” | C位面对面
- Hashicopy之nomad应用编排方案06(配置task)
- The Tree (AVL, 2-3-, 红黑,Huffman)
- China's SaaS development lags behind that of the United States for 10 years, and it still needs to rely on innovation, open source, M & A and other strategies | archsummit
- Dbutil auxiliary class, manual commit transaction, metadata
- Unity detects whether the object is within the viewing cone of the camera
- SQL:如何用采购单销售单的数据 通过移动加权平均法 计算商品成本
猜你喜欢

Dbutil auxiliary class, manual commit transaction, metadata

Live share experience

31w赛题奖金!当 AI for Science 撞上“先导杯”,会擦出什么样的火花?

一个时代的终结!十年了吴恩达经典《机器学习》课程本月关闭注册,上线新课!...

Energy storage operation and configuration analysis of high proportion wind power system (realized by Matlab)

How about NFT market? Why is NFT so popular? How to build NFT platform

看不懂Kotlin源码?从Contracts 函数说起~
![[signal de-noising] chromatographic baseline estimation and de-noising based on sparsity (beads) with matlab code and papers](/img/7f/8ffc83e5717275b27f1fd34111ca15.png)
[signal de-noising] chromatographic baseline estimation and de-noising based on sparsity (beads) with matlab code and papers

Bs-xx-007 registered residence management system based on JSP

长连接简介
随机推荐
【信号去噪】基于稀疏性 (BEADS) 实现色谱基线估计和去噪附matlab代码和论文
一个时代的终结!十年了吴恩达经典《机器学习》课程本月关闭注册,上线新课!...
InfoQ 极客传媒 15 周年庆征文|移动端开发之动态排行【MUI+Flask+MongoDB】
InfoQ geek media's 15th anniversary essay solicitation - dynamic ranking of mobile terminal development [mui+flask+mongodb]
Debian下设定 TCP/IP 网络
I am a graduating doctor majoring in mathematics. How should I choose an offer?
[acwing 11. solution number of knapsack problem] 01 knapsack + 01 knapsack + understand the specific meaning of 01 knapsack
Dbutil auxiliary class, manual commit transaction, metadata
How about NFT market? Why is NFT so popular? How to build NFT platform
Is the securities account opened in qiniu safe? How to apply for a low commission stock account?
2022 年,捕捉这 12 个数据和分析趋势!
Live share experience
历史上的今天:Apple II 问世;微软收购 GECAD;发明“软件工程”一词的科技先驱出生...
长连接简介
kubernetes 二进制安装(v1.20.15)(七)加塞一个工作节点
无延时/无延迟视频直播实例效果案例
[201] PHP exception handling - try catch finally exception handling in PHP
Terraform + Ansible实现基础设施及配置管理
Is byte really the end of the universe?
The tree (AVL, 2-3-, red black, Huffman)