CodeIgniter Forums
select multiple categories using join method - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: select multiple categories using join method (/thread-76033.html)



select multiple categories using join method - ci4hell - 04-08-2020

I have this database table structure for posts, categories and post_categories

posts: 
Code:
| id | title | details
| 1  | test  | test details

categories: 
Code:
| id | name     | parent_id
|. 1 | cat one  |     0
|  2 | cat two  |     0
|  3 | cat three|     0

post_categories
Code:
|category_id|post_id
|.     1    |.   1
|.     2.   |.   1


I insert multiple categories using input checkbox for each post in post_categories table. Now in update page i need to show categories list and checked input checkbox. how do can i generate this output using join method?!