Welcome Guest, Not a member yet? Register   Sign In
Filter database results?
#1

[eluser]Uplift[/eluser]
Hi, How can i filter results coming from the database? in this case it's by category,

i use the following code in my model:

Code:
function getEntries() {
    
     $this->db->order_by("id", "desc");
     $query = $this->db->get_where('work', array('published' => '1'));
    
     return $query->result_array();

}

and controller to call it:

Code:
$data['entries'] = $this->work_model->getEntries();

All pretty standard stuff but how do i filter by category?

eg, if user clicks 'all' it shows all entries, if user clicks 'web' it shows all websites

the links would be something like

/portfolio/ - if they click this link it would show all
/portfolio/web - if they click this link it will show only all websites
/portfolio/graphics - if they click this link it will show only all graphics


Messages In This Thread
Filter database results? - by El Forum - 02-13-2012, 01:18 PM
Filter database results? - by El Forum - 02-13-2012, 01:39 PM
Filter database results? - by El Forum - 02-13-2012, 01:51 PM
Filter database results? - by El Forum - 02-13-2012, 02:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB