Welcome Guest, Not a member yet? Register   Sign In
looping inside of a model
#4

[eluser]neph[/eluser]
well, what im trying to accomplish is a structured array that i cant seem to get from looping in the controller. below is my best representation of what im trying to do.
Code:
array(3) {
  [0]=>
  object(stdClass)#20 (7) {
    ["id"]=>
    string(1) "1"
    ["name"]=>
    string(7) "General"
    ["description"]=>
    string(36) "This area is for general discussions"
    ["privilege"]=>
    string(1) "0"
    ["active"]=>
    string(1) "1"
    ["numThreads"]=>
    int(1)
    ["numPosts"]=>
    string(1) "1"
  }
  [1]=>
  object(stdClass)#21 (7) {
    ["id"]=>
    string(1) "2"
    ["name"]=>
    string(10) "Neat stuff"
    ["description"]=>
    string(27) "this area is for neat stuff"
    ["privilege"]=>
    NULL
    ["active"]=>
    string(1) "1"
    ["numPosts"]=>
    int(1) "7"
    ["numThreads"]=>
    int(1) "12"
  }

that is the simplest output im trying to get.

so, for each instance of a category i want it to count the threads, and foreach instance of a thread count posts. i just assumed it should be done in the model since that's where the queries are coming from and using an &$value to append it to the existing array object.


Messages In This Thread
looping inside of a model - by El Forum - 01-29-2009, 01:00 AM
looping inside of a model - by El Forum - 01-29-2009, 01:30 AM
looping inside of a model - by El Forum - 01-29-2009, 06:42 AM
looping inside of a model - by El Forum - 01-29-2009, 12:19 PM
looping inside of a model - by El Forum - 01-29-2009, 01:26 PM
looping inside of a model - by El Forum - 01-29-2009, 01:36 PM
looping inside of a model - by El Forum - 01-29-2009, 02:43 PM
looping inside of a model - by El Forum - 05-01-2009, 10:57 PM
looping inside of a model - by El Forum - 05-02-2009, 11:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB