think 多表 分组三维数组

public function businessDraftShow(){        
        $model = D(‘business‘);// 实例化Data数据对象
        $data = $model->search(2);
        $shuju = $data[‘data‘];
        $page = $data[‘page‘];
        $count = $data[‘count‘];
          foreach($shuju as $n => $val)  
            {  
                $bus_id = $shuju[$n][‘id‘];
               $shuju[$n][‘flow_all‘] =  M(‘flow‘)->where(array(‘business_id‘ => $bus_id)) -> select();    
               $shuju[$n][‘comment_all‘] =  M(‘comment‘)->where(array(‘business_id‘ => $bus_id)) -> select();          
            //show_bug($n);
            }  
                        
        show_bug($shuju);
        
        $this->assign(‘data‘, $shuju);
        $this->assign(‘page‘, $page);
        $this->assign(‘count‘, $count);
        
        $type_array = array(‘0‘=>‘请选择‘,‘1‘ => ‘房产抵押‘,‘2‘=>‘车辆抵押‘,‘3‘=>‘其他业务‘);
        $business_node = array(‘0‘=>‘未提交受理‘,‘1‘=>‘已经退回‘,‘2‘=>‘已经受理‘);
        
        
        $this->assign(‘type_array‘,$type_array);
                
        $this->assign(‘business_node‘,$business_node);
        
        $this->display();
    }

这里是得到一个id,让后用这个id查别的表,然后添加到数组里面,assign到模板

结果是一个三维数组,我实在是用多表查不出来,希望大家给予帮助和指出

array(5) {
  [0]=>
  array(13) {
    ["id"]=>
    string(2) "30"
    ["business_num"]=>
    string(19) "DDZC-20140807183038"
    ["business_name"]=>
    string(12) "阿斯顿飞"
    ["business_type"]=>
    string(1) "0"
    ["proposer"]=>
    string(9) "张无忌"
    ["proposer_time"]=>
    string(19) "2014-08-07 18:30:38"
    ["special_state"]=>
    string(0) ""
    ["Accept_people"]=>
    string(0) ""
    ["Accept_time"]=>
    string(19) "0000-00-00 00:00:00"
    ["Accept_state"]=>
    string(0) ""
    ["node"]=>
    string(1) "1"
    ["flow_all"]=>
    array(3) {
      [0]=>
      array(8) {
        ["id"]=>
        string(2) "43"
        ["business_id"]=>
        string(2) "30"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-08-07 20:14:34"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(23) "
退回你太难看了"
      }
      [1]=>
      array(8) {
        ["id"]=>
        string(2) "44"
        ["business_id"]=>
        string(2) "30"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-08-08 09:16:51"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(14) "
阿斯顿飞"
      }
      [2]=>
      array(8) {
        ["id"]=>
        string(2) "45"
        ["business_id"]=>
        string(2) "30"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-08-08 10:36:30"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(18) "
这个也难看2"
      }
    }
    ["comment_all"]=>
    NULL
  }
  [1]=>
  array(13) {
    ["id"]=>
    string(2) "29"
    ["business_num"]=>
    string(19) "DDZC-20140807105706"
    ["business_name"]=>
    string(12) "我的业务"
    ["business_type"]=>
    string(1) "0"
    ["proposer"]=>
    string(9) "张无忌"
    ["proposer_time"]=>
    string(19) "2014-08-07 10:57:06"
    ["special_state"]=>
    string(0) ""
    ["Accept_people"]=>
    string(0) ""
    ["Accept_time"]=>
    string(19) "0000-00-00 00:00:00"
    ["Accept_state"]=>
    string(0) ""
    ["node"]=>
    string(1) "1"
    ["flow_all"]=>
    array(1) {
      [0]=>
      array(8) {
        ["id"]=>
        string(2) "47"
        ["business_id"]=>
        string(2) "29"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-08-08 11:41:20"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(14) "阿斯顿飞
"
      }
    }
    ["comment_all"]=>
    NULL
  }
  [2]=>
  array(13) {
    ["id"]=>
    string(2) "27"
    ["business_num"]=>
    string(19) "DDZC-20140805105045"
    ["business_name"]=>
    string(9) "撒旦发"
    ["business_type"]=>
    string(1) "1"
    ["proposer"]=>
    string(9) "张无忌"
    ["proposer_time"]=>
    string(19) "2014-08-05 10:50:45"
    ["special_state"]=>
    string(12) "阿斯顿飞"
    ["Accept_people"]=>
    string(0) ""
    ["Accept_time"]=>
    string(19) "0000-00-00 00:00:00"
    ["Accept_state"]=>
    string(0) ""
    ["node"]=>
    string(1) "0"
    ["flow_all"]=>
    NULL
    ["comment_all"]=>
    NULL
  }
  [3]=>
  array(13) {
    ["id"]=>
    string(2) "26"
    ["business_num"]=>
    string(19) "DDZC-20140730103651"
    ["business_name"]=>
    string(5) "asdf "
    ["business_type"]=>
    string(1) "0"
    ["proposer"]=>
    string(9) "张无忌"
    ["proposer_time"]=>
    string(19) "2014-07-30 10:36:51"
    ["special_state"]=>
    string(4) "asf "
    ["Accept_people"]=>
    string(0) ""
    ["Accept_time"]=>
    string(19) "0000-00-00 00:00:00"
    ["Accept_state"]=>
    string(0) ""
    ["node"]=>
    string(1) "1"
    ["flow_all"]=>
    array(2) {
      [0]=>
      array(8) {
        ["id"]=>
        string(2) "15"
        ["business_id"]=>
        string(2) "26"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-30 15:23:29"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "2"
        ["flow_state"]=>
        string(14) "
阿斯顿飞"
      }
      [1]=>
      array(8) {
        ["id"]=>
        string(2) "46"
        ["business_id"]=>
        string(2) "26"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-08-08 11:41:02"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(14) "
阿斯顿飞"
      }
    }
    ["comment_all"]=>
    NULL
  }
  [4]=>
  array(13) {
    ["id"]=>
    string(2) "25"
    ["business_num"]=>
    string(19) "DDZC-20140727202724"
    ["business_name"]=>
    string(9) "撒旦发"
    ["business_type"]=>
    string(1) "1"
    ["proposer"]=>
    string(9) "张无忌"
    ["proposer_time"]=>
    string(19) "2014-07-27 20:27:24"
    ["special_state"]=>
    string(9) "撒旦发"
    ["Accept_people"]=>
    string(0) ""
    ["Accept_time"]=>
    string(19) "0000-00-00 00:00:00"
    ["Accept_state"]=>
    string(9) "撒旦发"
    ["node"]=>
    string(1) "1"
    ["flow_all"]=>
    array(7) {
      [0]=>
      array(8) {
        ["id"]=>
        string(1) "1"
        ["business_id"]=>
        string(2) "25"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-29 17:08:17"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(14) "你太坏了
"
      }
      [1]=>
      array(8) {
        ["id"]=>
        string(1) "2"
        ["business_id"]=>
        string(2) "25"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-29 17:09:06"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(14) "
这个不行"
      }
      [2]=>
      array(8) {
        ["id"]=>
        string(1) "3"
        ["business_id"]=>
        string(2) "25"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-29 17:11:40"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(14) "
阿斯顿飞"
      }
      [3]=>
      array(8) {
        ["id"]=>
        string(1) "4"
        ["business_id"]=>
        string(2) "25"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-29 17:11:45"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "2"
        ["flow_state"]=>
        string(17) "
行就这样吧"
      }
      [4]=>
      array(8) {
        ["id"]=>
        string(1) "5"
        ["business_id"]=>
        string(2) "25"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-29 17:37:25"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "1"
        ["flow_state"]=>
        string(2) "
"
      }
      [5]=>
      array(8) {
        ["id"]=>
        string(1) "9"
        ["business_id"]=>
        string(2) "25"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-29 18:10:30"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "2"
        ["flow_state"]=>
        string(2) "
"
      }
      [6]=>
      array(8) {
        ["id"]=>
        string(2) "11"
        ["business_id"]=>
        string(2) "25"
        ["flow_id"]=>
        string(1) "0"
        ["flow_node"]=>
        string(1) "0"
        ["flow_time"]=>
        string(19) "2014-07-30 10:29:29"
        ["flow_people"]=>
        string(9) "业务员"
        ["flow_result"]=>
        string(1) "2"
        ["flow_state"]=>
        string(2) "
"
      }
    }
    ["comment_all"]=>
    NULL
  }
}

think 多表 分组三维数组

时间: 2024-10-11 17:01:32

think 多表 分组三维数组的相关文章

C语言三维数组分解

很多人在学习C的时候,感觉三维数组很难想象,而且不理解深度是什么?做了一个图,帮大家分解一下                                                                             比如int a[3][3][3]={{1,2,3},                                                                                                    

*三维数组的初始化及遍历三个for循环

package com.chongrui.test; /* *三维数组的初始化及遍历 * */ public class test { public static void main(String[] args) { int a[][][]=new int[][][]{ {{1,2,3},{4,5,6}}, {{8,9,10},{11,12,13}}, {{14,15,16},{17,18,19,20}}, }; for(int i=0;i<a.length;i++){ System.out.p

JAVA的 一维数组、二维数组、三维数组、多维数组等。

这个数组可以看做新手学习,从一维数组 到 多维 数组 循环渐进,其实看起也很简单,一看便知,众所周知,一维.二维或许经常用到,用到二维以上应该就很少了. public class test { public static void main(String[] args) { /*一维数组*/ int num[] = {0,1,2}; /*下面输出 3 行数据,0 ~ 2*/ for (int i = 0; i < num.length; i++) { System.out.println("

CUDA三维数组

http://hpcbbs.it168.com/forum.php?mod=viewthread&tid=1643 根据上面链接的帖子研究了下三维数组,就像他自己说的一样是有问题的,我自己修改了下,结果终于正确了.大家有兴趣的可以对照着看看. 整个过程关键参考了这篇文章http://www.xuebuyuan.com/685353.html 1 #include <stdio.h> 2 //#include <cutil.h> 3 #include <helper_c

Jni :三维数组处理方法 ,以整形三维数组为例 C++实现

本文原创,转载请注明地址:http://www.cnblogs.com/baokang/p/4982846.html 关于Jni的基本使用方法,请参阅:Java 调用 C++ (Java 调用 dll)康哥手把手教你 关于Jni的调试,请参阅:Jni 调试 : eclipse + Vs 联合调试 不废话了,直接上代码 1.java native 接口 /** * 将三维数组src中的每一个元素平方,dst进行输出 * @param src 输入 * @param dst 输出 */ public

一维数组,二维数组,三维数组,数组与指针,结构体数组,通过改变指针类型改变访问数组的方式

 打印数组中的每个元素,打印每个元素的地址: #include <stdio.h> #include <stdlib.h> void main(void) { int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; for (int *p = a; p < a + 10;p++)  //指针类型决定4个字节 { printf("\n%p,%d", p, *p); } getchar(); } 指针数组 #inclu

遍历三维数组2

1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 5 namespace 遍历三维数组 6 { 7 class Program 8 { 9 static void Main(string[] args) 10 { 11 12 13 int[, ,] szA = new int[2,3,4]{ 14 {{0,1,2,3}, 15 {4,5,6,7}, 16 {8,9,10,11}}, 17 {{12

php三维数组变二维数组

<?php $result = Array(0 => Array(0 => Array(bid => 41,brealname => 'we教官',cid => 41,crealname => 'we教官')), 1 => Array(0 => Array(bid => 6,brealname => '虎子',cid => 19,crealname => '张鱼')) ); //原数组 print_r($result); ech

处理三维数组,重新组合

0x01 三维数组中,选取其中的数据,重新组合 摘自SF上 记录下 Code: ------- function combineDika($data) { $result = array(); foreach (array_shift($data) as $k=>$item) { $result[] = array($k=>$item); } foreach ($data as $k => $v) { $result2 = []; foreach ($result as $k1=>