PHP Query question for search

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 7
Joined: Sun Jul 01, 2012 3:42 pm

Tue Jan 01, 2013 1:20 am

I have a query that works well for a 'keyword'. Can anyone tell me how I might code a query to pick up any word within a sentence? i.e. one that returns something on any of the words "all dogs go to heaven" as an example??? This works great for just a keyword but again, I'm hoping to return something for any word within a sentence. Thanks for any help.

$query =
"SELECT id, event, date, name, year
FROM $table
WHERE event LIKE '%$keyword%' OR name LIKE '%$keyword%' ";

$result = mysql_query($query);

Post Reply