Currently working on a small project with a few different database functions. I am trying to figure out a way to get the compiled Codeigniter WHERE statement.
// Database GET function
function dbGetRow($id, $field)
{
$this->db->select($field)->from('friends');
$query = $this->db->get();
return $query->row_array();
}
// Calling the function
$this->db->where('id', 2);
$value = parent::dbGetRow(null 'id');
What i am trying to figure out is how to get the compiled WHERE statement inside of the dbGetRow() function before performing the query.
Got this working.
the only solution is to use $this->db->get_compiled_select();
private function hasInlineQuery()
{
$string = $this->db->get_compiled_select();
$string = str_ireplace('SELECT *', '', $string);
return $string ? true : false;
}