2
回答
PHP两表关联查询操作

第一个表的typeid对应第二个表的id,time是对应表1的signedtime,typeid相同的合并,怎么才能得到这样的结果:

Array
(
    [0] => Array
        (
            [activity_id] => 2
            [name] => 王
            [mobile] => 
            [signed] => Array
                (
                    [0] => Array
                        (
                            [id] => 1
                            [activityid] => 2
                            [activityname] => 测试数据2多次签到
                            [signedname] => 一次签到
                            [create_time] => 1465181547
                            [listorder] => 0
                            [sign_img] => 
                            [type] => 
                            [time] =>1463056434
                        )

                    [1] => Array
                        (
                            [id] => 3
                            [activityid] => 2
                            [activityname] => 测试数据2多次签到
                            [signedname] => 二次签到
                            [create_time] => 1465182225
                            [listorder] => 0
                            [sign_img] => 
                            [type] => 
                            [time] =>1463074455
                        )

                    [2] => Array
                        (
                            [id] => 4
                            [activityid] => 2
                            [activityname] => 测试数据2多次签到
                            [signedname] => 三次签到
                            [create_time] => 1465189536
                            [listorder] => 0
                            [sign_img] => 
                            [type] =>
                            [time]=> 
                        )            

                )

        )

    [1] => Array
        (
            [activity_id] => 2
            [name] => zhang
            [mobile] => 
            [signed] => Array
                (
                    [0] => Array
                        (
                            [id] => 1
                            [activityid] => 2
                            [activityname] => 测试数据2多次签到
                            [signedname] => 一次签到
                            [create_time] => 1465181547
                            [listorder] => 0
                            [sign_img] => 
                            [type] => 
                            [time] =>
                        )

                    [1] => Array
                        (
                            [id] => 3
                            [activityid] => 2
                            [activityname] => 测试数据2多次签到
                            [signedname] => 二次签到
                            [create_time] => 1465182225
                            [listorder] => 0
                            [sign_img] => 
                            [type] =>
                            [time] =>
                        )

                    [2] => Array
                        (
                            [id] => 4
                            [activityid] => 2
                            [activityname] => 测试数据2多次签到
                            [signedname] => 三次签到
                            [create_time] => 1465189536
                            [listorder] => 0
                            [sign_img] => 
                            [type] => 
                            [time]=>1463036123
                        )

                   
                )

        )

)




PHP
举报
werwerds
发帖于2年前 2回/291阅
顶部