php - how to join a two tables with arrays of datas -
my first table category
contain categoryid
, categories
.
second table bloggers
contains bloggercategory
.
bloggercategory
contain array of categoryid
(more 1 categoryid
).
function selectusercategories($sess_id) { $this->db->select('*'); $this->db->from('categories'); $this->db->join('bloggers', 'blogger_category = category_id'); $this->db->where('id', $sess_id); $querycat = $this->db->get(); return $querycat->result(); }
can join 2 tables display bloggercategory
individualy array categories
. tried way not working.
for comma separated field, use mysql find_in_set()
select * categories c join bloggers b on find_in_set(c.category_id ,b.blogger_category)
Comments
Post a Comment