Codeigniter不稳定的Active Record结果

I did a simple select query with Codeigniter's Active Record, but somehow it has a different result from my real MySQL records.

MyModel.php

class MyModel extends CI_Model {
    public function get_pending_requests($admin_id) {
        $this->db->from('assignment');
        $this->db->where('admin_id', $admin_id);
        $this->db->where('requested IS NOT NULL');
        $this->db->where('approved IS NULL');
        $this->db->where('declined IS NULL');

        $result = $this->db->get()->result();

        var_dump($result);
        var_dump($this->db->last_query());

        return $result;
    }
}

I can assure you, that no matter how many time I run that code, it always return the same query:

string 'SELECT *
FROM (`assignment`)
WHERE `admin_id` =  '1'
AND `requested` IS NOT NULL
AND `approved` IS NULL
AND `declined` IS NULL' (length=126)

Yet with that exact same query, it returns different results.

Sometime it will return the correct result, which is null (since there is no record in assignment table).

But on the other times, it would return a record which already deleted.

object(stdClass)[36]
      public 'id' => string '14' (length=2)

There was a record with id 14, but it has been removed for a while.

Need tips.

I got worked out.

It seems to be related to mysql persistent connection.

Once I added this

$db['default']['pconnect'] = FALSE;

Everything is going great again.