Welcome Guest, Not a member yet? Register   Sign In
Not sure how to get a value from model and use in controller
#1

What I want to do is get a value from a model and use it in my controller to update another model.

The problem is I have a database of locations and parts, the parts are in a specific location based on locationID. But if the location name gets updated or deleted the old location name is still in the parts. So the way I thought I should do it is in my update method for the location in my controller is 

1. get the location name/location ID that the person wants to edit based on the URI segment for the location

2. put that location in a variable in the controller

3. update all location data (in the locations table) with input data from the user

4. update all part location data (in parts table) that matches the old location name that we put in that variable from step 2.



The main problem I have is how to get and use the locationID, locationName values from the model and use them in the controller. I've only used values from model to contoller to view before. Am I going about this right? If so how can I get the values and put them in variables to use in the controller? Thanks
Reply


Messages In This Thread
Not sure how to get a value from model and use in controller - by alexandervj - 08-05-2015, 12:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB