match() against ()需要4个参数才能工作吗?
你好,我正在尝试创建一个搜索引擎,我使用 match() against() 将我的关键字与用户的关键字进行匹配。当我将参数指定为 4 时,它不会显示任何错误,但是当我打开它时3或2我继续遇到这个错误:
警告:mysql_fetch_array()期望参数1是资源,布尔值给出...
这是我的代码:
if(isset($_POST['submit'])){
$keyword = "'".$_POST["keywords"]."'";
$result = " SELECT *, MATCH(title,body,meta_keywords) AGAINST
($keyword) AS score FROM articles WHERE MATCH(title,body,meta_keywords) AGAINST($keyword) GROUP BY url";
$query = mysql_query($result);
}
while($row = mysql_fetch_array($query)){
echo $row['title'] . "<br/ >";
}
?>
hello im trying to make a search engine and im using match() against() to match my keywords to the keyword of the user.. when i assigned my parameters to be 4 it doesn't show any error but when i have it on 3 or 2 i keep on having this error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in...
this is my code:
if(isset($_POST['submit'])){
$keyword = "'".$_POST["keywords"]."'";
$result = " SELECT *, MATCH(title,body,meta_keywords) AGAINST
($keyword) AS score FROM articles WHERE MATCH(title,body,meta_keywords) AGAINST($keyword) GROUP BY url";
$query = mysql_query($result);
}
while($row = mysql_fetch_array($query)){
echo $row['title'] . "<br/ >";
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这个
SELECT *, count (MATCH(title,body,meta_keywords) AGAINST
($keyword)) AS 分数来自文章 WHERE MATCH(title,body,meta_keywords) AGAINST($keyword IN BOOLEAN MODE) ORDER BY 分数 GROUP BY url
也许它在 sintaxs 中存在一些错误,我没有运行它,
你可以在 < a href="http://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html" rel="nofollow">mysql布尔模式全文搜索
try this
SELECT *, count (MATCH(title,body,meta_keywords) AGAINST
($keyword)) AS score FROM articles WHERE MATCH(title,body,meta_keywords) AGAINST($keyword IN BOOLEAN MODE) ORDER BY score GROUP BY url
maybe it there are some errors in sintaxs i didnt run it
you can find more at mysql full text search in boolean mode