![]() |
FIND_IN_SET() how to implement in mysql and codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: FIND_IN_SET() how to implement in mysql and codeigniter (/showthread.php?tid=71337) |
FIND_IN_SET() how to implement in mysql and codeigniter - jaydevvara - 08-01-2018 I Have two table in Database here i put my two table and i want record like Ex> Suppose if user 1 is login and user category_id is 1,2,3 then i want record from 2nd table like Home,Marketing,Customer so how to fire query FIND_IN_SET() in mysql and Codeigniter 1st* user_registration userid roll_id fullname username password category_id 1 1 admin [email protected] admin 1,2,3 2 2 user [email protected] user 1,2,3,4,5,6 2nd*Category category_id cname parentID 1 Home 0 2 Marketing 0 3 Customer 2 4 Quoation 2 5 New Customer 3 6 view Customer 3 RE: FIND_IN_SET() how to implement in mysql and codeigniter - salain - 08-01-2018 Hi, Use where_in with the content of the user's category_id field. some thing like this: PHP Code: $this->db->where_in('category_id',$users->category_id)->get('category'); RE: FIND_IN_SET() how to implement in mysql and codeigniter - jaydevvara - 08-01-2018 (08-01-2018, 10:40 PM)salain Wrote: Hi, What is $users? RE: FIND_IN_SET() how to implement in mysql and codeigniter - InsiteFX - 08-02-2018 that would be your model returned value (category_id) from your users table. RE: FIND_IN_SET() how to implement in mysql and codeigniter - jaydevvara - 08-02-2018 (08-02-2018, 03:54 AM)InsiteFX Wrote: that would be your model returned value (category_id) from your users table. i did not understand RE: FIND_IN_SET() how to implement in mysql and codeigniter - jreklund - 08-02-2018 userid = 1 have this: $users->category_id = array(1,2,3) userid = 2 have this: $users->category_id = array(1,2,3,4,5,6) So: $this->db->where_in('category_id',array(1,2,3))->get('category'); RE: FIND_IN_SET() how to implement in mysql and codeigniter - jaydevvara - 08-02-2018 (08-02-2018, 05:57 AM)jreklund Wrote: userid = 1 have this: Thank YOu dear |