I have a string that has a few of URLs separated by a | i.e. http://URL1|http://URL2|...|http://URL#
I am trying to build a string to be used in a query so the result will be:
$query = "OR page_url LIKE '%http://URL1%' OR page_url LIKE '%http://URL2%' OR page_url LIKE '%http://URL3%'"
This string will be added into a query I am preparing
$result = $db->prepare("SELECT * FROM table WHERE column1 = 'abc' :urlquery");
$result->bindValue(':urlquery', $query);
Would this work? Also is this the best way to run the query where I have OR page_url LIKE '% ... %' for every URL?
:urlqueryis going, and no value is expected there. You'll need to do this by concatenating the strings.