<?php
class Test_drag_Model extends CI_Model{
        
        function insert($arr)
        {
                
                $this->db->insert('blog_content', $arr);
                return $this->db->insert_id();
                
        }
        
        function update($id, $arr)
        {
        
                $this->db->where('id', $id);
                $this->db->update('blog_content', $arr);
        
        }
        function update_rank($id, $rank)
        {
                $data = array(
                        'rank' => $rank
                );

                $this->db->where('id', $id);
                $this->db->update('test_blog_tag_list', $data);

        }
        
        function get()
        {       

                    $this->db->select('*');
                    
                   
                    
                    $this->db->from('test_blog_tag_list');
                    $this->db->order_by('rank', 'ASC');
                    $query=$this->db->get();
                    //echo $this->db->last_query();
                return $query->result();
        }
        
        function get_id($id){
                $this->db->where('id', $id);
                $query = $this->db->get('blog_content');
                return $query->result();
        }
        
        function get_lang($lang)
        {
                
                $this->db->where('lang', $lang);
                $query = $this->db->get('blog_content');
                return $query->result();
                
        }
        
        function delete($id)
        {
                $arr=array();
                $arr['deleted'] =1;
                $this->db->where('id', $id);
                $this->db->update('blog_content', $arr);
        }
        
}

?>