Welcome Guest, Not a member yet? Register   Sign In
New to Joins and codeigniter
#8

[eluser]liam1412[/eluser]
I took out the posts bit but that doesn't seem like I would be able to use that in an easy way. It gives

Code:
object(CI_DB_mysql_result)#12 (7) {
  ["conn_id"]=>
  resource(28) of type (mysql link persistent)
  ["result_id"]=>
  resource(29) of type (mysql result)
  ["result_array"]=>
  array(0) {
  }
  ["result_object"]=>
  array(5) {
    [0]=>
    object(stdClass)#13 (2) {
      ["category_name"]=>
      string(16) "Off Topic Forums"
      ["forum_name"]=>
      string(11) "Off Topic 1"
    }
    [1]=>
    object(stdClass)#14 (2) {
      ["category_name"]=>
      string(11) "Site Forums"
      ["forum_name"]=>
      string(9) "Site News"
    }
    [2]=>
    object(stdClass)#15 (2) {
      ["category_name"]=>
      string(11) "Site Forums"
      ["forum_name"]=>
      string(10) "Site Rules"
    }
    [3]=>
    object(stdClass)#16 (2) {
      ["category_name"]=>
      string(14) "Subject Forums"
      ["forum_name"]=>
      string(15) "Subject Forum 1"
    }
    [4]=>
    object(stdClass)#17 (2) {
      ["category_name"]=>
      string(14) "Subject Forums"
      ["forum_name"]=>
      string(15) "Subject Forum 2"
    }
  }
  ["current_row"]=>
  int(0)
  ["num_rows"]=>
  int(5)
  ["row_data"]=>
  NULL
}

I had another crud class where you could declare a relationship and it would bring this sort of result.

Code:
Array
(
    [0] => Array
        (
            [cat_id] => 1
            [cat_name] => Category 1
            [cat_desc] => This is category 1
            [display_rank] => 0
            [private] => 0
            [forum_forums] => Array
                (
                    [0] => Array
                        (
                            [forum_id] => 2
                            [forum_cat_id] => 1
                            [forum_name] => Forum 1
                            [forum_desc] => This is forum 1
                            [display_rank] => 0
                            [lastpost_by] => 0
                            [lastpost_time] => 0
                        )

                    [1] => Array
                        (
                            [forum_id] => 5
                            [forum_cat_id] => 1
                            [forum_name] => This is another forum
                            [forum_desc] => This forum is about stuff
                            [display_rank] => 0
                            [lastpost_by] => 0
                            [lastpost_time] => 0
                        )

                )

        )

    [1] => Array
        (
            [cat_id] => 2
            [cat_name] => Category 2
            [cat_desc] => This is category 2
            [display_rank] => 0
            [private] => 0
            [forum_forums] => Array
                (
                    [0] => Array
                        (
                            [forum_id] => 3
                            [forum_cat_id] => 2
                            [forum_name] => Forum 2
                            [forum_desc] => This is forum 2
                            [display_rank] => 0
                            [lastpost_by] => 0
                            [lastpost_time] => 0
                        )

                )

        )

    [2] => Array
        (
            [cat_id] => 3
            [cat_name] => Category 3
            [cat_desc] => This is category 3
            [display_rank] => 0
            [private] => 0
            [forum_forums] => Array
                (
                    [0] => Array
                        (
                            [forum_id] => 4
                            [forum_cat_id] => 3
                            [forum_name] => Forum 3
                            [forum_desc] => This is forum 3
                            [display_rank] => 0
                            [lastpost_by] => 0
                            [lastpost_time] => 0
                        )

                )

        )

)


With this I could use a foreach loop to get the categories, then within that foreach I could use a foreach to get the forums with that category.

Thanks for looking


Messages In This Thread
New to Joins and codeigniter - by El Forum - 09-01-2009, 05:09 PM
New to Joins and codeigniter - by El Forum - 09-01-2009, 05:29 PM
New to Joins and codeigniter - by El Forum - 09-01-2009, 05:47 PM
New to Joins and codeigniter - by El Forum - 09-01-2009, 10:55 PM
New to Joins and codeigniter - by El Forum - 09-01-2009, 11:00 PM
New to Joins and codeigniter - by El Forum - 09-01-2009, 11:13 PM
New to Joins and codeigniter - by El Forum - 09-01-2009, 11:28 PM
New to Joins and codeigniter - by El Forum - 09-01-2009, 11:31 PM
New to Joins and codeigniter - by El Forum - 09-02-2009, 11:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB