![]() |
Append multiple time dbprefix - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: Append multiple time dbprefix (/showthread.php?tid=81454) |
Append multiple time dbprefix - Aarzu - 03-04-2022 While executing search query with CodeIgniter 4 the dB prefix appended two times. below is the query SELECT `db_deposit`.`id`, `db_deposit`.`member_no`, `date_of_seed`, `db_member`.`name`, `amount_planted_week`, `harvest_date`, `db_admin`.`firstname`, `db_admin`.`lastname` FROM `db_deposit` LEFT JOIN `db_admin` ON `db_admin`.`admin_id`=`db_deposit`.`added_by` LEFT JOIN `db_member` ON `db_member`.`id`=`db_deposit`.`member_id` WHERE (`db_``db_deposit`.`id` LIKE '%ddd%' ESCAPE '!' OR `db_``db_deposit`.`member_no` LIKE '%ddd%' ESCAPE '!' OR `amount_planted_week` LIKE '%ddd%' ESCAPE '!' OR `db_``db_admin`.`firstname` LIKE '%ddd%' ESCAPE '!' ) ORDER BY `db_deposit`.`id` DESC LIMIT 10 Code is something like this, if ($request['search']['value'] != '') { $builder->groupStart(); for ($i = 0; $i < count($datatable_fields); $i++) { if ($request['columns'][$i]['searchable'] == true) { $builder->orLike($datatable_fields[$i], $request['search']['value']); } } $builder->groupEnd(); } Can anyone help me with this! RE: Append multiple time dbprefix - iRedds - 03-04-2022 https://github.com/codeigniter4/CodeIgniter4/issues/5775 RE: Append multiple time dbprefix - shakirahrp - 03-17-2022 (03-04-2022, 06:27 AM)Aarzu Wrote: While executing search query with CodeIgniter 4 the dB prefix appended two times. Can you tell me for which purpose are you using this database, I am seeing that the line `db_admin`.`admin_id`=`db_deposit`.`added_by` LEFT JOIN `db_member` ON is not properly coded. |