title: How can i display error messages in CodeIgniter
body: <p><strong>Controller:</strong></p>
  
  <pre><code> public function add_year() {
          $session_id = $this-&gt;session-&gt;userdata('id');
          if (!empty($session_id)) {
              $this-&gt;form_validation-&gt;set_rules('year_name', 'Year Name', 'required');
              if ($this-&gt;form_validation-&gt;run() == FALSE) {
                  $data = array(
                      'page_title' =&gt; 'Add Year',
                      'page_name' =&gt; 'year/add_year',
                      'admin_username' =&gt; $this-&gt;session-&gt;userdata('username')
                  );
                  $this-&gt;load-&gt;view('admin/template', $data);
              } else {
                  $this-&gt;year_model-&gt;insert($_POST);
                  redirect('admin/Year');
              }
          } else {
              redirect('admin/Login');
          }
      }
  </code></pre>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>  public function insert($data) {
          $result = $this-&gt;db-&gt;get_where('year', array('year_name' =&gt; $data['year_name']))-&gt;row_array();
          if (empty($result)) {
              $insert_data = array('year_name' =&gt; $data['year_name']);
              $this-&gt;db-&gt;insert('year', $insert_data);
          } else {
              $error = "Year Name Already Exits";
              return $error;
          }
      }
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>&lt;div class="text-danger"&gt;
      //display error message
  &lt;/div&gt;
  </code></pre>
  
  <p>MY Question: How can i display model error message in view............................................................</p>