[eluser]NateL[/eluser]
I'm trying to pass two values into a model so that I can run a query that tests against both values.
What's the best way to handle this?
I've tried these two methods:
Controller:
Code:
$myVar = $this->the_model->the_method($var1, $var2);
the_model.php
Code:
function the_method($var1, $var2){
$this->db->select('*')->
from('foo')->
where('foo1', $var1)->
where('foo2', $var2);
}
This doesn't seem to work, So I tried loading the variables up into an array - but I still got botched results
controller:
Code:
$theVars = array();
$theVars['var1'] = '1';
$theVars['var2'] = '2';
$myVar = $this->the_model->the_method($theVars);
the_model.php
Code:
function the_method($theVars){
$this->db->select('*')->
from('foo')->
where('foo1', $theVars['var1'])->
where('foo2', $theVars['var2']);
}
still not quite giving me results I'm after.
Thanks for any tips