What is the correct syntax for a WHERE LIKE query in PHP?

When using a WHERE LIKE query in PHP, the correct syntax involves using the '%' wildcard character to match any sequence of characters in a specified column. This allows for more flexible searching within a database table. The LIKE keyword is used to specify the pattern to search for, and the '%' wildcard can be placed before, after, or both before and after the pattern to match any characters before, after, or on both sides of the pattern.

// Example of a WHERE LIKE query in PHP
$search_term = 'example';
$sql = "SELECT * FROM table_name WHERE column_name LIKE '%$search_term%'";
$result = mysqli_query($connection, $sql);

// Loop through the results
while ($row = mysqli_fetch_assoc($result)) {
    // Process the retrieved data
}