Sunday, April 27, 2014

Codeigniter: Active Record, join with no condition (fix bug)

Fix untuk "DB_active_rec.php".
1. Edit function 
public function join($table, $cond, $type = '')
rubah menjadi,
public function join($table, $cond = '', $type = '')
 2. Masih di dalam function join, cari
// Assemble the JOIN statement 
$join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond; 
rubah menjadi,
// Assemble the JOIN statement
if ($cond != '')
$join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond.' ';
else
$join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ';
3. Done