【发布时间】:2012-10-24 02:11:30
【问题描述】:
我有一个基本的搜索引擎。在一个脚本中,它使用在 html 网页中扫描的单词填充 MYSQL 表。基于一个词搜索,它在网页中出现最多的词时对结果进行排名。
但我需要处理多个术语查询。有没有办法从下面的查询中搜索多个字词?
$keyword = addslashes( $_POST['keyword'] );
$results = addslashes( $_POST['results'] );
/* Execute the query that performs the actual search in the DB: */
$result = mysql_query(" SELECT p.page_url AS url,
COUNT(*) AS occurrences
FROM page p, word w, occurrence o
WHERE p.page_id = o.page_id AND
w.word_id = o.word_id AND
w.word_word = \"$keyword\"
GROUP BY p.page_id
ORDER BY occurrences DESC
LIMIT $results" );
【问题讨论】:
标签: php