My current query (doesn’t work)
SELECT url
FROM table
WHERE
'http://www.longurl.com/some/string' like '%' . url . '%'
table
url
longurl.com
I am trying to match the record in “table” for longurl.com to any compared URL that contains longurl.com.
Should match compared URLs such as:
http://www.longurl.com/some/string
http://longurl.com
http://longurl.com/some/string
In this PHP example, it is very easy to compare:
$url = "http://www.longurl.com/some/string";
if(strstr($url, 'longurl.com')) {
echo "success";
} else {
echo "failure";
}
Okay, what about:
(Formatting didn’t work so well in the comments, so I added it again as an answer.)