title: Getting values into dropdown from DB
body: <p>I want to use my db values of table (Category) into a product/add form, but not able to get the values. </p>
  
  <pre><code>Model :
   function getAllCategories()
      {
          $query = $this-&gt;db-&gt;get('category');
          return $query-&gt;result_array();
      }
  
   Controller:
  
  function getAllCategories()
     {
        $data['groups'] = $this-&gt;productmodel-&gt;getAllCategories();
  
         $this-&gt;load-&gt;view('admin/product/add',$data);
     }   
  
    View:
  
  &lt;div class="form-group"&gt;
                    &lt;label for="exampleInputEmail1"&gt;Brand &lt;/label&gt;
                    &lt;select class="form-control"&gt;
                  &lt;?php 
                  $i = 0;
                  while($i &lt; count($groups)){
                    $val= $groups[$i]['value'];
                    $des = $groups[$i]['category_name'];
                    echo "&lt;option value='$i'&gt;$des&lt;/option&gt;";
                  }?&gt;
                 &lt;/select&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>Help me please it is urgent.I took reference from stack overflow only, but was not able to do it.</p>