I want to search 3 columns using the OR clause. I’m missing something simply, I know, but I keep getting a mysql error.
Here’s what I have so far:
SELECT customerid,companyname,firstname,lastname
FROM `tbl_customers`
WHERE customeronoff = 1
AND customerrecordtype = 'A'
AND (companyname LIKE '$query%') OR (lastname LIKE '$query%') OR (firstname LIKE '$query%')
ORDER BY lastname ASC
I must be placing the OR’s wrong. Would someone fix me, please
Use paranethesis to group your
ORstaements: