build query for 2 different table - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: build query for 2 different table (/showthread.php?tid=80218) |
build query for 2 different table - zhikri - 09-30-2021 i have 2 table, profiles and details. trackid in details table is a foreign key that references to trackid in profiles table which is a primary key Code: profiles table: first i have list all of department from profiles table, then i put detail button to show detail from each department. so when it clicked, it will redirect to the details page of clicked department and show number of employee and its name from details table. is there any suggestion to build query in models for this case? thank you RE: build query for 2 different table - includebeer - 10-04-2021 Look for the join() function on this page: https://codeigniter.com/user_guide/database/query_builder.html PHP Code: $builder = $db->table('blogs'); |