I have a php function in codeignter set up to run a query based on all the values it is given. By default, it's set up in my model like so:
function get_news($page=0, $limit=4, $offset=0, $name=0) {
if($name == 0) {
$query = $this->db->get('table', $limit, $offset);
} else {
$query = $this->db->get_where('table', array('name'=>''.$name.''), $limit, $offset);
}
}
However when I pass a value for $name in my controller, it runs the query for $name==0
$name = "Bob";
$this->News_model->get_news($page=0, $limit=3, $offset=0, $name);
Any idea why the $name value isn't going through?