Welcome Guest, Not a member yet? Register   Sign In
Forced to run DB Query from View (Bad practice?)
#4

[eluser]bradym[/eluser]
1 - Get the id of the current category
2 - Get the children of the current category

I always have a parent field in category tables, so it would be a simple query:

Code:
$this->db->query("SELECT name FROM category WHERE parent = $category_id");

You could easily combine both steps into one function in your model.


Messages In This Thread
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 09:10 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 09:16 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 10:45 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 12:30 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 01:39 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 04:31 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 05:23 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 05:30 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 06:24 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 04:04 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 05:14 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 06:42 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 07:39 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-28-2008, 10:37 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-28-2008, 10:53 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 07:10 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 05:11 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 06:17 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 07:37 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 08:55 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 10:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB