PHP Query question for search

General discussions related to php

Moderators: macek, egami, gesf

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

PHP Query question for search

Postby cover » 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);

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests