I have a list of domains in an array e.g.
$notAllowedWebsites = array('google.com','yahoo.com','facebook.com');
Now I have a MySQL database that contains a column full of urls e.g.
- facebook.com/testpage
- google.com/search
- bbc.co.uk/news/going-to-the-sea
- ft.com/big-success
- google.com/time
Now I want to extract the above URLS from the above table where the domains exist in the url. In other words I want to extract: 1. facebook.com/testpage 2. google.com/search 3. google.com/time
This is my code:
foreach($notAllowedWebsite as $notAllowedWebsite){
$sqlQueryBusinessWebsite = $dbh->prepare("SELECT business_website FROM client_table WHERE business_website = :business_website");
$sqlQueryBusinessWebsite->execute(array(':business_website'=>$notAllowedWebsite));
$sqlResultBusinessWebsite = $sqlQueryBusinessWebsite->fetch();
$businessWebsiteDB = $sqlResultBusinessWebsite['business_website'];
}
I'm not sure how I'm going to modify this line $sqlQueryBusinessWebsite = $dbh->prepare("SELECT business_website FROM client_table WHERE business_website = :business_website");
to check whether the domain exists in the url.
Thanks.