title: Selecting records from a database table in PHP using CodeIgniter and pass to a view
body: <p>I'm making a query in PHP using CodeIgniter to get the data that I wanted from a database. To be able to get all values for a specific column, I stored it into an array and passed it into a view. But I can do it only for one column.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>$query = $this-&gt;db-&gt;query('SELECT name, description FROM module');
  
  $result = $query-&gt;result_array();
  
  foreach ($result as $key =&gt; $rowdata) { 
      $resultdata['values'][$key] = $rowdata['name'];    
  }
  
  $this-&gt;load-&gt;view('myview', $resultdata);
  </code></pre>
  
  <p>With this scenario I can get all name from the module table. But my problem is, I also wanted to get all the description in the module table, but I don't know how can I implement it and be able to pass it into the view. Hope someone could help me with this. Thanks!</p>