MySQL WHERE clause using LIKE
I have a column in a table that contains domain names. I want to use the $_SERVER['HTTP_HOST'] value to see if the domain name exists in my table. If one of the rows has 'abcdomain.com' in the domain name column, how do I code the WHERE LIKE clause to check for true against 'abcdomain.com', or 'www.abcdomain.com', or test.abcdomain.com', etc.?
My current PHP select statement looks like the following and is only returning true on the 'abcdomain.com':
SELECT * FROM myTable WHERE domainName LIKE '%".strtolower($_SERVER['HTTP_HOST'])."' LIMIT 1
Note: I recognize that the problem is my "haystack" string is smaller than the "needle" string in some instances. So I need to figure a way to handle that or otherwise swap the clause to something like this:
'%".strtolower($_SERVER['HTTP_HOST'])."' LIKE domainName
Thank you for your help.