[eluser]jedd[/eluser]
Hello Henrique and welcome to the CI forums.
[quote author="Henrique Mascarenhas" date="1258232121"]
... about model inside model (does not work). My solution was like this:
[/quote]
You didn't say whether you did that code in your Controller or your Model .. ?
In general terms, CI doesn't use a Model like a traditional Object - we usually load each Model only once , and treat it as a kind of library or collection of related database interactions.
With that in mind, there's a couple of ways you can solve your problem.
First, if you have two models that need to call functions in each other's code you can use the
get_instance() function to gain access to one from the other.
Alternatively you can merge the functionality of the two models into one bigger model. This might be easier - a model can provide an interface to multiple tables, and this is an OK thing to do.
Looking at the code you've provided, I think you might be better getting all your rows in one fell swoop - using the
result_array() function for example.
If you want to treat your Models as Objects - in the classic definition of an Object - then you should search through the forums for the word 'object' in thread titles, as the subject comes up fairly regularly.