What are the potential issues with allowing the search script to display all database entries when no input is provided?

Allowing the search script to display all database entries when no input is provided can lead to performance issues, as it may retrieve a large number of records unnecessarily. To solve this issue, we can add a check to ensure that the search query is not executed if no input is provided.

// Check if search input is provided
if(isset($_GET['search'])) {
    // Execute search query
    $search = $_GET['search'];
    $query = "SELECT * FROM table_name WHERE column_name LIKE '%$search%'";
    // Rest of the code to execute the query and display results
} else {
    echo "Please enter a search term.";
}