function updateviews($id, $table, $views) { $CI =& get_instance(); $views_curr = $views + 1; $CI->db->where('id', $id); $CI->db->where('id_lang', GetIdLang()); $CI->db->update($table, array('views' => $views_curr)); }
function GetAll($tbl, $filter = array()) { $CI =& get_instance(); foreach ($filter as $key => $value) { $exp = explode("/", $value); if (isset($exp[1])) { if ($exp[0] == "where") { $CI->db->where($key, $exp[1]); } else { if ($exp[0] == "like") { $CI->db->like($key, $exp[1]); } else { if ($exp[0] == "order") { $CI->db->order_by($key, $exp[1]); } else { if ($key == "limit") { $CI->db->limit($exp[1], $exp[0]); } } } } } else { if ($exp[0] == "where") { $CI->db->where($key); } } if ($exp[0] == "group") { $CI->db->group_by($key); } } if ($tbl == "kg_news_subcategory" || $tbl == "contents" || $tbl == "news" || $tbl == "news_category" || $tbl == "kg_view_news") { $CI->db->where("id_lang", GetIdLang()); } $q = $CI->db->get($tbl); return $q; }