I have been using a library for subqueries to work - Subquery.php Ref : https://github.com/NTICompass/CodeIgniter-Subqueries
$this->db->select('test');
$this->db->select('test2');
$this->db->from('table');
$sub = $this->subquery->start_subquery('where_in');
$sub->select('IDs');
$sub->from('idTable');
$sub->where('date', '2011-07-10');
$this->subquery->end_subquery('id');
I think that this statement:
$sub = $this->subquery->start_subquery('where_in');
contains the error. When I execute this line, I get a blank page. The fn. start_subquery is:
function start_subquery($statement, $join_type = '', $join_on = 1){
$db = $this->CI->load->database('', true); // after executing this statement, a blank page shows...
$this->dbStack[] = $db;
$this->statement[] = $statement;
if(strtolower($statement) == 'join'){
$this->join_type[] = $join_type;
$this->join_on[] = $join_on;
}
return $db;
}
FYI - In my database.php:
$active_group = 'default'
$active_record = TRUE;
And CI version is 2.1.0
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '****';
$db['default']['password'] = '***';
$db['default']['database'] = '****';
$db['default']['dbdriver'] = 'mysql';
The rest of the config is default. – Vishnu Prem May 27 '12 at 14:36