load->database(); $this->load->library('session'); } #--------------------------------------------------------------------------- # PURPOSE : list # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_where_member_id_list($req_data){ # request $offset = $req_data['offset']; $limit = $req_data['limit']; $search_type = $req_data['search_type']; $search_keyword = $req_data['search_keyword']; $member_id = $req_data['member_id']; if($search_type!='' && $search_keyword != '') { if($search_type=='total') { $this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")'); } else { $this->db->where($search_type.' like "%'.$search_keyword.'%"'); } } $this->db->where('member_id', $member_id); $this->db->where('is_del', 'N'); $this->db->from('bbs_question'); $this->db->limit($limit, $offset); $this->db->order_by('p_idx', 'desc'); $this->db->order_by('s_idx', 'asc'); $res = $this->db->get(); // echo $this->db->last_query(); $row = $res->result_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : list - total count # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_where_member_id_list_total_count($req_data){ # request $search_type = $req_data['search_type']; $search_keyword = $req_data['search_keyword']; $member_id = $req_data['member_id']; if($search_type!='' && $search_keyword != '') { if($search_type=='total') { $this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")'); } else { $this->db->where($search_type.' like "%'.$search_keyword.'%"'); } } $this->db->where('is_del', 'N'); $this->db->where('member_id', $member_id); $this->db->from('bbs_question'); $row = $this->db->count_all_results(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : max idx # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_max_idx_select(){ # request $this->db->select('max(idx) as max_idx'); $this->db->from('bbs_question'); $res = $this->db->get(); $row = $res->row_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : insert # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_insert($req_data){ $row = $this->db->insert('bbs_question', $req_data); return $row; } #--------------------------------------------------------------------------- # PURPOSE : write_id and idx count # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_write_id_idx_count($req_data){ # request $write_id = $req_data['write_id']; $idx = $req_data['idx']; $this->db->where('is_del', 'N'); $this->db->where('write_id', $write_id); $this->db->where('idx', $idx); $this->db->from('bbs_question'); $row = $this->db->count_all_results(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : is_del update batch # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_is_del_update_batch($req_data){ $row = $this->db->update_batch('bbs_question', $req_data, 'idx'); return $row; } #--------------------------------------------------------------------------- # PURPOSE : is_del update batch # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_p_idx_is_del_update_batch($req_data){ $row = $this->db->update_batch('bbs_question', $req_data, 'p_idx'); return $row; } #--------------------------------------------------------------------------- # PURPOSE : write_id and idx select # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_write_id_idx_select($req_data){ # request $write_id = $req_data['write_id']; $idx = $req_data['idx']; $this->db->where('is_del', 'N'); $this->db->where('write_id', $write_id); $this->db->where('idx', $idx); $this->db->from('bbs_question'); $res = $this->db->get(); $row = $res->row_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : member_id and idx select # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_member_id_idx_select($req_data){ # request $member_id = $req_data['member_id']; $idx = $req_data['idx']; $this->db->where('is_del', 'N'); $this->db->where('member_id', $member_id); $this->db->where('idx', $idx); $this->db->from('bbs_question'); $res = $this->db->get(); $row = $res->row_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : next list # CREATE : 2018-05-05 #--------------------------------------------------------------------------- function bbs_question_next_parent_list($req_data){ # request $offset = $req_data['offset']; $limit = $req_data['limit']; $search_type = $req_data['search_type']; $search_keyword = $req_data['search_keyword']; $member_id = $req_data['member_id']; $idx = $req_data['idx']; if($search_type!='' && $search_keyword != '') { if($search_type=='total') { $this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")'); } else { $this->db->where($search_type.' like "%'.$search_keyword.'%"'); } } $this->db->where('p_idx < ', $idx); $this->db->where('member_id', $member_id); $this->db->where('is_del', 'N'); $this->db->where('s_idx', '1'); $this->db->from('bbs_question'); $this->db->limit($limit, $offset); $this->db->order_by('p_idx', 'desc'); $res = $this->db->get(); $row = $res->result_array(); return $row; } } ?>