title: Invalid argument supplied for foreach error in codeigniter
body: <p>Here is my code in codeigniter</p>
  
  <p><strong>IN MODEL</strong> </p>
  
  <pre><code>    $where = "is_display ='Yes' AND start_date &lt; '{$current_time}' AND end_date &gt;              
               '{$current_time}' AND status = 'Live' AND id NOT IN (SELECT id FROM (emts_auction)                           
               WHERE is_display = 'Yes' AND quantity =1 AND sold_qty &gt;0    
               AND last_auc_ending_time &lt; '{$current_time}')";
  
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('auction');
      $this-&gt;db-&gt;where($where);       
      $this-&gt;db-&gt;order_by("id", "desc");
      $query = $this-&gt;db-&gt;get();
      $data = $query-&gt;result();
          $query-&gt;free_result();
          return $data;
  </code></pre>
  
  <p><strong>IN VIEW</strong></p>
  
  <pre><code>  &lt;?php foreach($auction_view as $auction)
         {
         echo $auction-&gt;name;
         echo $auction-&gt;price;
         echo $auction-&gt;bid_fee;
         }
        ?&gt;
  </code></pre>