I have the following codeigniter model function:
function get_successful($project_id, $amount_backed){
$data = '';
$this->db->where('id', $project_id);
$this->db->where($amount_backed >= 'funding_goal'); //HELP HERE
$this->db->where('published', '1');
......
return $data;
}
I need to only get records where the variable $amount_backed is higher or equal to the field 'funding_goal'.
How can this be done with codeigniters active record?
One possibility would be:
Also see the CodeIgniter User Guide, search for
$this->db->where();and look atCustom key/value method, there is following example:P.s.: there are two more alternatives: Associative array method and Custom string.