title: How to retrieve data from database through anchor tag and display in list in html using codeigniter
body: <p>anyone please help me to retrieve the db data and how to view it in html table.in the below code i was trying to fetch data from database using anchor tag. please tell me hoe should is write it in codeigniter.and i have to display that by clicking that on that anchor tag dynamically.</p>
  
  <p><strong>controller</strong></p>
  
  <pre><code>public function index()
  {
      $this-&gt;load-&gt;view('afc_view');
  }
  
  function search_course()
  {
          $data['results'] = $this-&gt;afc_search-&gt;search_course();
          $this-&gt;load-&gt;view('afc_view', $data);
  }
  </code></pre>
  
  <p><strong>model</strong></p>
  
  <pre><code>function search_course()
  {
      $query = $this-&gt;db-&gt;query("SELECT course_name FROM courses");
      return $query-&gt;result();
  }
  </code></pre>
  
  <p><strong>view</strong></p>
  
  <pre><code>                        &lt;h3&gt;Search&lt;/h3&gt;
                      &lt;/div&gt;
                      &lt;div class="Loc"&gt;
                          &lt;div class="l"&gt;Location
                          &lt;/div&gt;
                          &lt;div id="loc"&gt;
                              &lt;ul class="loct" &gt;
                                  &lt;li class ="active"&gt;
                                      &lt;a href="&lt;? echo base_url('afcks/search_course');?&gt;"&gt;Camp
                                      &lt;/a&gt;
  
                                          &lt;ul class="course"&gt;
                                              &lt;li &gt;
  
                                                  &lt;a title="excel" href="#"&gt;
  
                                                  &lt;/a&gt;
                                              &lt;/li&gt;
                                          &lt;/ul&gt;
                                  &lt;/li&gt;
  
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="center"&gt;
                  &lt;div id="top"&gt;
                          &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#"&gt;About Us&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#"&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
                      &lt;/div&gt;
                  &lt;!--&lt;div id="side"&gt;
                  &lt;/div&gt;--&gt;
              &lt;/div&gt;
  
  
  
      &lt;/div
  </code></pre>