Jump to content


Photo

searching variants for a keyword


  • Please log in to reply
2 replies to this topic

#1 hhhhhhh

hhhhhhh
  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 19 November 2005 - 02:26 AM

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!

#2 bljepp69

bljepp69
  • Members
  • PipPipPip
  • Advanced Member
  • 111 posts
  • LocationSacramento, CA

Posted 19 November 2005 - 02:37 AM

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.
Guru? No, but I do RTFM

#3 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 19 November 2005 - 04:23 AM

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

Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users