inserting data in codeigniter with simplest example and explain MVC in short
<p>This is my model.But dont know how to insert data in database.Actually i am new to codeigniter please tell me some simple example of data insertion, maybe of form data insertion. </p>

<pre><code>&lt;?php        
class News_model extends CI_Model {            
        public function __construct(){         
                $this-&gt;load-&gt;database();                
        }                                            
        public function get_news($slug = FALSE){                
        if ($slug === FALSE){                        
                $query = $this-&gt;db-&gt;get('news');                 
                return $query-&gt;result_array();                         
        }                                             
        $query = $this-&gt;db-&gt;get_where('news', array('slug' =&gt; $slug));                   
        return $query-&gt;row_array();                
}                  
public function view($slug = NULL){    
        $data['news_item'] = $this-&gt;news_model-&gt;get_news($slug);    
        if (empty($data['news_item'])){    
                show_404();    
        }    

        $data['title'] = $data['news_item']['title'];    
        $this-&gt;load-&gt;view('templates/header', $data);    
        $this-&gt;load-&gt;view('news/view', $data);`enter code here`    
        $this-&gt;load-&gt;view('templates/footer');    
}
}
</code></pre>