Solved : Newbie question - Working with models |
[eluser]ywftdg[/eluser]
Anyone? Is it possible/proper to do multiple queries in one model function? If so, how do you pass the results to each one?
[eluser]m4rw3r[/eluser]
I cannot see why it would be forbidden. Here is an example of using data from the first query in the second: Code: // first query, fetch a page:
[eluser]ywftdg[/eluser]
There seems no obvious way to rewrite this query, I am just going to ditch this or hire someone. No matter how many ways I try to say 'while result' or 'foreach' it kills my controller or kills my models, seems CI doesn't want to do things this way. I am close to tossing y computer out the window, not worth the stress. I do not understand how something so basic as a loop can be so confusing. Model Code: function get_bundles() { Controller Code: $query = $this->reports->get_bundles(); Also, when I try to run the if statement in the model instead, it wont work, nor do I understand how to get it to"add" this results to my return$query last line. Code: function get_bundles() { No matter what sort of scenario I try here, this wont work. Its just amazing how ridiculous this is, because it was so easy to write in my old code. Im looking at this wrong somehow, at this point i'm at a dead stop, I have tried endless methods, none of these work ad im just talking to myself on here now, hahaha.
[eluser]ywftdg[/eluser]
Solved: http://ellislab.com/forums/viewthread/88156/ |
Welcome Guest, Not a member yet? Register Sign In |