Welcome Guest, Not a member yet? Register   Sign In
Two Different Querys same Model
#1

[eluser]datguru[/eluser]
Hi there wondering if any of you out there can help me with a small problem.

Iam trying to use the MVC approach and it seems to be really helping me with organisation but I have run into a problem. I cant seem to do 2 lots of query's with the same model. In the below code what I am trying to do is get the raw materials first and then get the labor details afterwards and thats b change the type field. However for some reason it cant do both. Any ideas?

Thanks


Code:
$this->load->model("mdl");

        //Generate Materials for selected product
        $this->mdl->product_id = $this->uri->segment(4); //ID gained from URL to select correct product ID
        $this->mdl->type = "raw_material";
        $product_parts = $this->mdl->get();

        $data['product_parts_materials'] = $product_parts;
        
        //Generate Labor for selected product
        $this->mdl->product_parts->type = "labor";
        $product_parts2 = $this->mdl->getLabor();
        $data['product_parts_labor'] = $product_parts2;
        
        //build data to fill in form to edit
        $this->mdl_products->product_id = $this->uri->segment(4);
        //echo $this->mdl_products->product_id;
        $results = $this->mdl_products->get();


Messages In This Thread
Two Different Querys same Model - by El Forum - 11-18-2008, 02:20 PM
Two Different Querys same Model - by El Forum - 11-18-2008, 02:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB