CI Forum - get_where function for forum and topics |
What's the actual goal of your database structure? So that you can re-use forum(s) inside multiple categories (with different layouts)?
If that's the case a structure like this would be much more sense. Because your database dump dosen't contain a link between classic/modern and categories. https://pastebin.com/WnrcWc4D Categories = All categories, position and layout (modern/classic) Forums = Forums Layouts = Maps what forum goes into what category and in what order (position) Note: position_id inside layouts should be layouts_id. ____________________________________________ You can pass plain SQL queries with this, it's faster then using the query builder. That's regarding the first database structure not the last one I did. PHP Code: $this->db->query("SELECT `forums`.`category_id`, `categories`.`category_title`, `categories`.`category_layout`, `forums`.`forum_id`, `forums`.`forum_image`, `forums`.`forum_title`, `forums`.`forum_description` FROM `forums` INNER JOIN `categories` ON `forums`.`category_id`=`categories`.`category_id` ORDER BY `categories`.`category_position` ASC, `forums`.`forum_position` ASC This should be the same, but slower. PHP Code: $this->db->select('`forums`.`category_id`, `categories`.`category_title`, `categories`.`category_layout`, `forums`.`forum_id`, `forums`.`forum_image`, `forums`.`forum_title`, `forums`.`forum_description`') |
Welcome Guest, Not a member yet? Register Sign In |