0

我有两个不同的模型函数 event_person1 和 event_person5,我需要按两个带有 event_id 的模型的结果进行分组,模型在这里

public function event_person1($user_id){
$details1 ="select * from event where created_by={$user_id} order by created_date   desc";
$details = $this->db->query($details1);     
$res = $details->result_array();
return $res;
}

public function event_person5($employee_id,$user_id) {
$query="select distinct(event_id) from event_booth where booth_owner='{$employee_id}'";
$sql=$this->db->query($query);
$res=$sql->result_array();
$arr=array();
foreach($res as $r)
{ 
$data['id']=$r['event_id'];
$query1="select * from event where (event_id={$data['id']} and created_by!=      {$user_id})";
$sql1=$this->db->query($query1);
$res1=$sql1->result_array();
if(!empty($res1))
{
$arr[] = $res1;
}
unset($res1);
}
return $arr;
}
4

0 回答 0