Welcome Guest, Not a member yet? Register   Sign In
Calling a function from a function and passing data within same model?
#1

[eluser]rhopek[/eluser]
I feel like I am so close to getting a great handle on this CI framework, but one thing is currently stumping me.

Let's say I have a model that has a function, and that function performs a query that will include an 'id' field/value and stores it in the $data[] array, among many other key/value pairs.

Now I have another function in that same model that needs to receive that value for the 'id' field in the previous function. I then want to perform a new query using that 'id' value, which will sum a number of values from other tables (which is why there isn't a join being used in the original function; it would be far too difficult). I then want to feed that summed value back into the original $data[] array from the first function so that the complete array can be passed to a view from that original function.

My questions:

1) How do I call the second function from within the first and pass it the required value?
2) How do I return the additional key/value from the second function back to he first so that the full $data[] array can be passed to the view?

I'm been trying to make it happen for about the last 4 hours and have come to the conclusion I need some help.


Messages In This Thread
Calling a function from a function and passing data within same model? - by El Forum - 10-26-2010, 12:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB