How can wildcards and LIKE statements be incorporated into a SQL query for database searches in PHP?

Wildcards and LIKE statements can be used in SQL queries to perform pattern matching in database searches. In PHP, you can incorporate wildcards such as '%' and '_' into your SQL query string when using the LIKE keyword to search for specific patterns within a column. By using wildcards, you can search for partial matches or patterns within the data stored in your database.

$search_term = 'example'; // Search term with or without wildcards
$query = "SELECT * FROM table_name WHERE column_name LIKE '%$search_term%'";
$result = mysqli_query($connection, $query);

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