title: CodeIgniter : How to get data by ID and preview it (Where ID)
body: <p>I have 2 table : </p>
  
  <ol>
  <li>product_group</li>
  <li>product</li>
  </ol>
  
  <p>which is every product have group_id as Foreign Key in the table.</p>
  
  <p>I try to call every product by group_id.</p>
  
  <p>this is my list_group view :</p>
  
  <pre><code> &lt;a href="&lt;?= base_url('list_group/get_product_by_group/'. $value-&gt;group_id);?&gt;" class="right-icon"&gt;&lt;i class="icon-line-ellipsis"&gt;&lt;/i&gt;&lt;/a&gt;
  </code></pre>
  
  <p>I try to attach the group_id in URL.</p>
  
  <p>this is my controller :</p>
  
  <pre><code>    public function get_product_by_group($group_id)
      {
  
              if($this-&gt;uri-&gt;segment(3))
              {
                      $this-&gt;load-&gt;database();
                      $group_id = $this-&gt;input-&gt;get('group_id', TRUE);
                      $data['product_data'] = $this-&gt;group_model-&gt;list_product_by_group($group_id);
                      $this-&gt;load-&gt;view('fend/list_product', $data);
  
              }
              else
              {
                      redirect('list_group');
              }
  
      }
  </code></pre>
  
  <p>This is my model :</p>
  
  <pre><code>        function list_product_by_group($group_id)
          {
                  $this-&gt;db-&gt;select('*');
                  $this-&gt;db-&gt;where('group_id', $group_id);
                  $query = $this-&gt;db-&gt;get('product');
                  return $query-&gt;result();
          }
  </code></pre>
  
  <p>and the last is list_product view :</p>
  
  <pre><code> &lt;?php
        foreach($product_data as $value)
        {
   ?&gt;
  
     &lt;div class="masonry-thumbs col-3" data-big="2" data-lightbox="gallery"&gt;
        &lt;a href="&lt;?= base_url('uploads/'. $value-&gt;product_picture);?&gt;" data-lightbox="gallery-item"&gt;&lt;img class="image_fade" src="&lt;?= base_url('uploads/'. $value-&gt;product_picture);?&gt;" alt="Gallery Thumb 1"&gt;&lt;/a&gt;
     &lt;/div&gt;
  
   &lt;?php
       }
   ?&gt;
  </code></pre>
  
  <p>I got no error, but the data did not appear in product_view.</p>
  
  <p>Thanks for your help :))</p>