Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1746

General Questions/New to Joomla! 4.x • SQL WHERE clause with two OR conditions

$
0
0
Hello,

I am trying to create a query that is satisfied when either column1 or column2 contains a desired string (stored in variable $search). The following code works but seems to be doing AND instead of OR logic. How to I do OR with where?

Code:

$query->where($db->quoteName('column1') . ' LIKE :search1')->where($db->quoteName('column2') . ' LIKE :search2')->bind([':search1', ':search2'], $search);
Thanks!

Statistics: Posted by JanoD — Tue Jul 09, 2024 9:05 am



Viewing all articles
Browse latest Browse all 1746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>