I have a variable that is a sentence for example this is a sentence. I have a MySQL database which has rows where one column contains the following:
"random sentences" 
"few random words" 
"this is cool"
"a car" 
"nice placement"
I need to print out occurrences of any word in the sentence existing in the database rows. For the example sentence given above, the result would be:
"random sentences" 
"this is cool" 
"a car" 
This is what I have tried so far:
<?php
$servername = "localhost";
$username = "dsfdsfds";
$password = "sdfdfsdsf";
$dbname = "sdf";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$galleries = "This is a sentence";
$sql = "
SELECT * 
  FROM rawwords 
 WHERE origin LIKE '%" . $galleries. "%'
";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["id"]. " - location: " . $row["sentence"]. " <br><br>";
    }
} else {
    echo "0 results";
}
$conn->close();
?> 
 
     
     
    