title: How can I convert db query result to array
body: <p>original I thought the $query is array object, since I can print these data to a list table like this.
  my controller code</p>
  
  <pre><code>$data['dates'] = $this-&gt;calendar_model-&gt;get_cal_eventDate();
  $this-&gt;load-&gt;library('table');
  $this-&gt;load-&gt;view('my_test', $data);
  </code></pre>
  
  <p>my view code</p>
  
  <pre><code>echo $this-&gt;table-&gt;generate($dates);
  </code></pre>
  
  <p>but when I changed my code to try to print $tbDataArr  via <code>foreach</code>. It didn't work. How can I convert the $query result (eventDate field values) to array object.</p>
  
  <pre><code>function get_cal_eventDate() {
      $this-&gt;db-&gt;select('eventDate');
          $query = $this-&gt;db-&gt;get('tb_event_calendar');
          return $query;
  }
  
  $tbDataArr = $this-&gt;calendar_model-&gt;get_cal_eventDate();
  
  foreach ($tbDataArr as $key =&gt; $value) {
      echo "Key: $key; Value: $value&lt;br /&gt;\n";
  }
  </code></pre>