title: Codeigniter function returning an empty query
body: <p>I have this function on my model, which receives a parameter so I can pre-load some information on the view page, but somehow is coming back empty:</p>
  
  <pre><code>function addTicket($idt)
      {
          //Db Connection
          $DB2 = $this-&gt; load-&gt; database('DB2', TRUE);
          if (!empty($idt)){
  
              $query = $DB2-&gt;query ("
                      Select TROUBLE_ID, ASSIGNED_DATE, CREATOR, PROBLEM_DESCRIPTION, RESOLUTION, RESOLVED_DATE 
                      FROM TABLE1
                      WHERE TROUBLE_ID = ".$idt." 
                      "); 
  
          if($query){
  
              return $query-&gt;result_array();
          }
          else 
              {
  
          echo 'No Queries to display';
              }
          }
          else {echo 'No results to display';}
      }
  </code></pre>
  
  <p>I have an Oracle DB with a ton of entries, but the query keeps coming back empty, Just in case I did an <code>echo 'id:'.$idt.;</code> to check if the ID is being passed. And yes it is.
  Also Im getting this message:
  <strong>Fatal error: Call to a member function result_array() on a non-object</strong></p>
  
  <p>On my view page i have this code:</p>
  
  <pre><code>foreach($results as $row){ }
  </code></pre>
  
  <p>And im getting this message now:
  <strong>A PHP Error was encountered
  Severity: Warning
  Message: Invalid argument supplied for foreach()
  Any idea why this is not working?</strong></p>