CodeIgniter Forums
Using LIKE query in HAVING Clause - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Using LIKE query in HAVING Clause (/showthread.php?tid=75950)



Using LIKE query in HAVING Clause - ezxcess - 03-31-2020

I need to build a query where I will have a clause like the following

SELECT *
FROM tableA 
LEFT JOIN tableB
LEFT JOIN tableC
WHERE tableA.active = 1
HAVING tableC.columnA LIKE '%$search_term%';

  1. How can I do this using the query builder?
  2. How can I ensure that the query is protected from SQL injection?
Thanks.


RE: Using LIKE query in HAVING Clause - dave friend - 04-01-2020

If you have tried something that doesn't work and need advice on how to fix it then this is the place to be. But, this isn't a code writing service. Please make a minimal effort before you ask for someone's time and expertise.