当前位置:网站首页>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);
}
}
}
边栏推荐
- On software defects and loopholes
- InfoQ 极客传媒 15 周年庆征文|移动端开发之动态排行【MUI+Flask+MongoDB】
- BS-XX-007基于JSP实现户籍管理系统
- Is byte really the end of the universe?
- [arcgis] City relevance analysis
- [signal processing] digital signal processing matlab design with GUI interface and report
- How can tampermonkey replace flash player with H5 player?
- [backtrader source code analysis 46] cerebro Py code comments (boring, one of the core backtrader codes, recommended for reading, comments for reference only)
- C# 设置窗体和系统的光标形状
- 无延时/无延迟视频直播实例效果案例
猜你喜欢

Using vscode code code template to improve mobx coding efficiency

看不懂Kotlin源码?从Contracts 函数说起~

The tree (AVL, 2-3-, red black, Huffman)

为什么每运行一部都显示一次数据库已存在,都要删除数据库,然后才能成功,每运行一部都要删除一次数据库,重新运行整体才成功.

NFT市场怎么样 为什么NFT能如此火爆 怎么搭建NFT平台

Ecplise cannot connect to SQL Server

Will Apple build a search engine?

长连接简介

Introduction to common fonts

高比例风电电力系统储能运行及配置分析(Matlab实现)
随机推荐
Will Apple build a search engine?
2022工具钳工(中级)操作证考试题库及答案
Nomad application layout scheme 07 of hashicopy (submit job)
Nomad application scheduling scheme 08 of hashicopy (detection job)
深度学习与CV教程(14) | 图像分割 (FCN,SegNet,U-Net,PSPNet,DeepLab,RefineNet)
SAP Spartacus 中的 checkout(结帐) 设计
AGV机器人RFID传感器CK-G06A与西门子1200PLC应用手册
苹果将造搜索引擎?
Bs-xx-007 registered residence management system based on JSP
@How to resolve controller and requestmapping
三级分类展示
长连接简介
Shader shader
火山引擎云数据库 veDB 在字节内部的业务实践
利用 VSCode 的代码模板提高 MobX 的编码效率
2022工具钳工(中级)操作证考试题库及答案
【系统分析师之路】系统分析师错题章节集锦
Kubernetes binary installation (v1.20.15) (VI) deploying worknode nodes
Development of smart contract DAPP system for TRX wave field chain
SAP Spartacus checkout process uses URL paste to directly jump to delivery mode. Why the page cannot be opened