title: odbc num_rows codeigniter result_set is empty
body: <p>I use this code to verify the user.</p>
  
  <pre><code>public function verify_user($username, $password)
  {
      $q = $this-&gt;db-&gt;where('username', $username)
          -&gt;where('password', md5($password))
          -&gt;limit(1)
          -&gt;get('users');
  
      if ($q-&gt;num_rows() === 1) {
          echo '&lt;pre&gt;';
          print_r($q-&gt;row());
          echo '&lt;/pre&gt;';
      } else {
          echo 'EMPTY';
      }
  }
  </code></pre>
  
  <p>But, when it equals 1, it display nothing.</p>
  
  <pre><code>Array
  (
  )
  </code></pre>
  
  <p>It appear when I use this code to fix odbc num_rows = -1 issue: <a href="https://github.com/EllisLab/CodeIgniter/blob/develop/system/database/drivers/odbc/odbc_result.php" rel="nofollow">CODEIGNITER Issue</a> on line 40 until 67</p>
  
  <p><strong>EDIT =============================</strong></p>
  
  <p>What I want to achive is this</p>
  
  <pre><code>stdClass Object
  (
      [id_user] =&gt; 2
      [username] =&gt; 114080077
      [password] =&gt; 0d5ccab9e7f4ae3fe040f143046e386c
  )
  </code></pre>
  
  <p>Code that I modify is:
  <strong>Before (STABLE VERSION)</strong>:</p>
  
  <pre><code>/**
   * Number of rows in the result set
   *
   * @access  public
   * @return  integer
   */
  function num_rows()
  {
      return @odbc_num_rows($this-&gt;result_id);
  }
  </code></pre>
  
  <p><strong>After (ISSUE FIX)</strong>:</p>
  
  <pre><code>/**
   * Number of rows in the result set
   *
   * @return  int
   */
  public function num_rows()
  {
      if (is_int($this-&gt;num_rows))
      {
          return $this-&gt;num_rows;
      }
      elseif (($this-&gt;num_rows = @odbc_num_rows($this-&gt;result_id)) !== -1)
      {
          return $this-&gt;num_rows;
      }
  
      // Work-around for ODBC subdrivers that don't support num_rows()
      if (count($this-&gt;result_array) &gt; 0)
      {
          return $this-&gt;num_rows = count($this-&gt;result_array);
      }
      elseif (count($this-&gt;result_object) &gt; 0)
      {
          return $this-&gt;num_rows = count($this-&gt;result_object);
      }
  
      return $this-&gt;num_rows = count($this-&gt;result_array());
  }
  </code></pre>