Jump to content

Archived

This topic is now archived and is closed to further replies.

hhhhhhh

searching variants for a keyword

Recommended Posts

I'm trying to buid up a search engine to my web site, and when I hid the search button for example for "computer" it only shows me results for pages which includes only the word computer.

 

but it would be ok if I would get a results as well for "computers" which has just a little "s" added to this string

 

 

 

this is my query

 

SELECT p.page_url AS url,

COUNT(*) AS occurrences

FROM r_page p, r_word w, r_occurrence o

WHERE p.page_id = o.page_id AND

w.word_id = o.word_id AND

w.word_word = \"$keyword\" ->> and here is the keyword

GROUP BY p.page_id

ORDER BY occurrences DESC

 

how can I do IT? i;ve tried with

 

w.word_word LIKE \"$keyword\" and won;t work

 

thanks guys!

Share this post


Link to post
Share on other sites

You may want to check out this excellent tutorial on [a href=\"http://www.phpfreaks.com/tutorials/129/0.php\" target=\"_blank\"]MySQL Full-Text Searching with PHP[/a]. Your query will be set up differently, but you are likely to get back better results.

Share this post


Link to post
Share on other sites

if you want to do it with LIKE, put % around the keyword

 LIKE '%$keyword%' 

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.