What is the issue with multiple LIKE queries in PHP when fetching data from a MySQL database?

When using multiple LIKE queries in PHP to fetch data from a MySQL database, it can result in slower performance due to the need to execute multiple queries. To solve this issue, you can use a single query with multiple OR conditions in the WHERE clause to search for multiple patterns at once.

<?php
// Connect to MySQL database
$connection = mysqli_connect("localhost", "username", "password", "database");

// Search query
$search_term = "keyword";
$query = "SELECT * FROM table_name WHERE column_name LIKE '%$search_term%' OR column_name LIKE '%$search_term2%'";

// Execute the query
$result = mysqli_query($connection, $query);

// Fetch and display the results
while ($row = mysqli_fetch_assoc($result)) {
    echo $row['column_name'] . "<br>";
}

// Close the connection
mysqli_close($connection);
?>