<?php

$input = $_GET['input'];//Note to self $input in the name of the search


    $terms = explode(" ", $input);
    $query = "SELECT * FROM  `#####` WHERE 1 LIMIT 0 , 30";

    foreach ($terms as $each){
        $i++;
        if ($i == 1)
            $query .= "keywords LIKE '%$each%' ";
        else
            $query .= "OR keywords LIKE '%$each%' ";
    }

    // connecting to our mysql database
    mysql_connect("#####", "#####", "#####");
    mysql_select_db("#####");

    $query = mysql_query($query);
    $numrows = mysql_num_rows($query);
    if ($numrows!=0){

        while ($row = mysql_fetch_assoc($query)){
            $id = $row['id'];
            $title = $row['title'];
            $description = $row['description'];
            $keywords = $row['keywords'];
            $url = $row['url'];
            echo "<h2><a href='$url'>$title</a></h2>
            $description<br /><br />";

        }

    }
    else
        echo "Não foram encontrados resultados para \"<b>$input</b>\"";

    // disconnect
    mysql_close();
?>

Your keywords like ... should come BEFORE limit 0,30. That's why the query fails.

You are trying to execute a wrong query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.