title: display images from database in codeigniter
body: <p>i have upload the images to the database.now i want display in another page.but i have no idea how to do that.i have add a code for view image which i found in internet.but it doesn't work.please any one can help me.</p>
  
  <p>my view</p>
  
  <pre><code>    &lt;!-- Page Heading --&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-lg-12"&gt;
                          &lt;h1 class="page-header"&gt;
                           Plan
  
                          &lt;/h1&gt;
                          &lt;ol class="breadcrumb"&gt;
                              &lt;li&gt;
                                  &lt;i class="fa fa-dashboard"&gt;&lt;/i&gt;  &lt;a href="index.html"&gt;Home&lt;/a&gt;
                              &lt;/li&gt;
                              &lt;li class="active"&gt;
                                  &lt;i class="fa fa-file"&gt;&lt;/i&gt; Floor Plan
                              &lt;/li&gt;
                          &lt;/ol&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;!-- /.row --&gt;
  
  
  &lt;body&gt;
  
      &lt;div id="response"&gt;&lt;/div&gt;
  &lt;div class="well"&gt;
  
  &lt;div class="container"&gt;
      &lt;div class="row"&gt;
  
      &lt;table&gt;
       &lt;tr&gt;
  
  
        &lt;td&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; Title&lt;/strong&gt;&lt;/td&gt;
        &lt;td&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; Client &lt;/strong&gt;&lt;/td&gt;
        &lt;td&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; Draw By&lt;/strong&gt;&lt;/td&gt;
        &lt;td&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp;Floor Plan&lt;/strong&gt;&lt;/td&gt;
      &lt;/tr&gt;
       &lt;?php foreach($post as $post){?&gt;
       &lt;tr&gt;
  &lt;!--         &lt;td&gt;&lt;?php //echo $post-&gt;id;?&gt;&lt;/td&gt;--&gt;
           &lt;td&gt;&lt;?php echo $post-&gt;id ; echo '&amp;nbsp; &amp;nbsp;';?&gt;&lt;/td&gt;
  &lt;!--         &lt;td&gt;&lt;?php echo $post-&gt;title ; echo '&amp;nbsp; &amp;nbsp;';?&gt;&lt;/td&gt;
           &lt;td&gt;&lt;?php echo $post-&gt;firstname ; echo '&amp;nbsp;';?&gt;&lt;?php echo $post-&gt;lastname  ; echo '&amp;nbsp; &amp;nbsp;'?&gt;&lt;/td&gt;
           &lt;td&gt;&lt;?php echo $post-&gt;first_name ; echo '&amp;nbsp;';?&gt;&lt;?php echo $post-&gt;last_name  ; echo '&amp;nbsp; &amp;nbsp;'?&gt;&lt;/td&gt;--&gt;
           &amp;nbsp; &amp;nbsp;&lt;td&gt;&lt;?php echo $post-&gt;image ; echo '&amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp;'?&gt;&lt;/td&gt;
        &lt;/tr&gt;  
        do { 
  echo "&lt;img src='path/to/image.php?id=".$row['id']."' /&gt;"; 
  } while($row = mysql_fetch_assoc(res));
  
       &lt;?php }
  
       ?&gt;  
     &lt;/table&gt;
  
  
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>controller</p>
  
  <pre><code> &lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class Floor_plan extends CI_Controller{
  
  public function __construct() {
          parent::__construct();
          $this-&gt;load-&gt;database(); // load database
          $this-&gt;load-&gt;model('floor_model');
  
  
  }
  
      public function index(){  
  
   $data['post'] = $this-&gt;floor_model-&gt;get_plan(); // calling Post model method getPosts() 
          $this-&gt;load-&gt;view('user_include/header');
          $this-&gt;load-&gt;view('plan/floor',$data);
      }
  
  
  
   }
  
  ?&gt;
  </code></pre>
  
  <p>model</p>
  
  <pre><code>    &lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?&gt;
  
  &lt;?php
  class Floor_model extends CI_Model {
  
  
  function get_plan(){
    $this-&gt;db-&gt;select("floor_plan.id,floor_plan.image");
    $this-&gt;db-&gt;from('floor_plan');
  
    $query = $this-&gt;db-&gt;get();
    return $query-&gt;result();
  }
  }
  ?&gt;
  </code></pre>