ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  Building a Simple Search Engine with PHP
Subject:   A more detailed query...
Date:   2003-12-23 06:52:17
From:   anonymous2
Hi Daniel,

Thanks again for your fantastic tutorial. I was wondering how one might submit a query which exclueds certain words and includes others. I know that the following should work for finding several words:

$result = mysql_query(" SELECT p.page_url AS url,
COUNT(*) AS occurrences
FROM page p, word w1, occurrence o1, word w2, occurrence o2
WHERE p.page_id = o1.page_id AND
w1.word_id = o1.word_id AND
w1.word_word = \"$keyword[1]\" AND
w2.word_id = o2.word_id AND
w2.word_word = \"$keyword[2]\" AND
GROUP BY p.page_id
ORDER BY occurrences DESC
LIMIT $results" );

But how can I also tell it to NOT provide me with an article that contains a word I don't want as well?

- Giff

1 to 2 of 2
  1. A more detailed query...
    2003-12-23 22:43:15  anonymous2 [View]

  2. RE: A more detailed query...
    2003-12-23 07:15:55  dsolin [View]

1 to 2 of 2