如何将根据不同表id查询到的值统一返回到数组中?

2026-04-03 05:121阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计236个文字,预计阅读时间需要1分钟。

如何将根据不同表id查询到的值统一返回到数组中?

phppublic function selProductionDetails($id) { // 获取产品详情表中的所有信息,根据传递的产品ID $details=$this->db->select('production_details_id, production_list_id, ps_id, product_name') ->where('product_id', $id) ->get('production_details') ->result_array();}

取数据库不同表的值统一返回

public function sel_production_details($id) { // 取到详情工序表中的所有信息,根据传过来的产品id $date['arr'] = $this->db ->select('production_details_id,production_list_id,ps_id,production_personnel_id,plan_work_hours,production_start_time,production_end_time,production_state,production_remark,inspector_id') ->where('production_list_id',$id) ->get('production_details') ->result_array(); //根据上面取到值里的一些别的表的id,取该id下所对应的值 foreach ($date['arr'] as $k=>$v){ $date['arr'][$k]['ps_name'] = $this->sel_ps_name($v['ps_id']); $date['arr'][$k]['ps_superior_id'] = $this->sel_ps_superior_id($v['ps_id']); $date['arr'][$k]['quality_testing_status'] = $this->sel_quality_testing_status($v['production_details_id']); $date['arr'][$k]['quality_testing_remark'] = $this->sel_quality_testing_remark($v['production_details_id']); $date['arr'][$k]['quality_testing_time'] = $this->sel_quality_testing_time($v['production_details_id']); $date['arr'][$k]['realname'] = $this->sel_realname($v['production_personnel_id']); $date['arr'][$k]['inspector_name'] = $this->sel_inspector_id($v['inspector_id']); } return $date; } // 根据工序id 工序名称 public function sel_ps_name($id) { $ps_name = $this->db ->where('ps_id',$id) ->get('procedure_setting') ->row_array()['ps_name']; if (empty($ps_name)) { return ''; }else{ return $ps_name; } }

如何将根据不同表id查询到的值统一返回到数组中?

本文共计236个文字,预计阅读时间需要1分钟。

如何将根据不同表id查询到的值统一返回到数组中?

phppublic function selProductionDetails($id) { // 获取产品详情表中的所有信息,根据传递的产品ID $details=$this->db->select('production_details_id, production_list_id, ps_id, product_name') ->where('product_id', $id) ->get('production_details') ->result_array();}

取数据库不同表的值统一返回

public function sel_production_details($id) { // 取到详情工序表中的所有信息,根据传过来的产品id $date['arr'] = $this->db ->select('production_details_id,production_list_id,ps_id,production_personnel_id,plan_work_hours,production_start_time,production_end_time,production_state,production_remark,inspector_id') ->where('production_list_id',$id) ->get('production_details') ->result_array(); //根据上面取到值里的一些别的表的id,取该id下所对应的值 foreach ($date['arr'] as $k=>$v){ $date['arr'][$k]['ps_name'] = $this->sel_ps_name($v['ps_id']); $date['arr'][$k]['ps_superior_id'] = $this->sel_ps_superior_id($v['ps_id']); $date['arr'][$k]['quality_testing_status'] = $this->sel_quality_testing_status($v['production_details_id']); $date['arr'][$k]['quality_testing_remark'] = $this->sel_quality_testing_remark($v['production_details_id']); $date['arr'][$k]['quality_testing_time'] = $this->sel_quality_testing_time($v['production_details_id']); $date['arr'][$k]['realname'] = $this->sel_realname($v['production_personnel_id']); $date['arr'][$k]['inspector_name'] = $this->sel_inspector_id($v['inspector_id']); } return $date; } // 根据工序id 工序名称 public function sel_ps_name($id) { $ps_name = $this->db ->where('ps_id',$id) ->get('procedure_setting') ->row_array()['ps_name']; if (empty($ps_name)) { return ''; }else{ return $ps_name; } }

如何将根据不同表id查询到的值统一返回到数组中?