Try:

$query =
"SELECT id, description, date, requester, year, notes
FROM $table
WHERE description LIKE '%keyword%' OR notes LIKE '%keyword%'";

However, if description and notes are text data type then you should use 
the MySQL MATCH syntax.

Best regards,
Jim

iDimensionz <http://www.idimensionz.com> - professional web site 
programming, affordable web site hosting.

j0hncage wrote:
>  
>
> I have a php query that is querying a mysql db table and I'm passing
> along the variable contents of 'keyword' from an input form. From
> there, I'm trying to query two different db table columns of data.
> I'm hopeful to be able to pick up a word like 'roof' as the keyword
> and if it exists anywhere in the 'description' or 'notes' columns of
> that table, return it to the screen. It works somewhat but also
> currently returns some garbage that wasn't a part of the keyword.
> Below is the code that I'm using. Anyone have any ideas on how I
> might eliminate the garbage? When I say 'garbage', I'm referring to
> some results that really have nothing to do with the inputted
> keyword. If I remove "OR notes", it does a wonderful job of just
> returning keyword info related to 'description' but I'd like to
> include the 'notes' column of the table effectively in the query. TIA
>
> $keyword = $_POST['keyword'];
>
> $query =
> "SELECT id, description, date, requester, year, notes
> FROM $table
> WHERE description OR notes LIKE '%$keyword%' ";
>
> 


[Non-text portions of this message have been removed]

Reply via email to