load->database(); $this->load->library('session'); } #--------------------------------------------------------------------------- # PURPOSE : join relation_article join news list # CREATE : 2018-04-04 #--------------------------------------------------------------------------- function weather_join_relation_article_join_news_list(){ $this->db->where('a.is_del', 'N'); $this->db->where('a.display_status', '1'); $this->db->where('b.content_type', '5'); $this->db->where('c.is_del', 'N'); $this->db->from('weather as a'); $this->db->join('relation_article as b', 'a.idx = b.content_idx'); $this->db->join('news as c', 'c.idx = b.relation_article_idx'); $this->db->order_by('a.rank', 'asc'); $res = $this->db->get(); $row = $res->result_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : join relation_article limit 1 # CREATE : 2018-04-04 #--------------------------------------------------------------------------- function weather_join_relation_article_limit1(){ $this->db->select('a.*, (select relation_article_idx from relation_article where content_type="5" and a.idx=content_idx order by idx asc limit 1) as relation_article_idx'); $this->db->where('a.is_del', 'N'); $this->db->where('a.display_status', '1'); $this->db->from('weather as a'); $this->db->order_by('a.rank', 'asc'); $res = $this->db->get(); $row = $res->result_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : join relation_article join news where news_idx select # CREATE : 2018-04-04 #--------------------------------------------------------------------------- function weather_join_relation_article_join_news_where_news_idx_select($news_idx){ $this->db->select('a.*'); $this->db->where('a.is_del', 'N'); $this->db->where('a.display_status', '1'); $this->db->where('b.content_type', '5'); $this->db->where('c.is_del', 'N'); $this->db->where('c.idx', $news_idx); $this->db->from('weather as a'); $this->db->join('relation_article as b', 'a.idx = b.content_idx'); $this->db->join('news as c', 'c.idx = b.relation_article_idx'); $res = $this->db->get(); $row = $res->row_array(); return $row; } } ?>