请先阅读我的问题,然后你会发现它不是其他问题的重复。
我正在使用 sphinx 搜索 98% 的搜索,但只需要对一个查询使用匹配。
正如我们从 mysql 文档中知道的那样, AGAINST 只接受字符串。The search string must be a literal string, not a variable or a column name.
但我找到了这个链接http://bugs.mysql.com/bug.php?id=66573,它说这是可能的。但我不确定如何在我的情况下使用它。
这是我的代码
$sqli="SELECT busi_title,category FROM `user`.`user_det`";
$queryi=mysqli_query($connecti,$sqli);
if(mysqli_num_rows($queryi)>0){
while($rowi=mysqli_fetch_assoc($queryi)){
$busi_title=$rowi['busi_title'];
$category=$rowi['category'];
}
}else{
echo "OH NO";
}
$sqlj="SELECT * FROM `user`.`user_det` WHERE MATCH(student) AGAINST('$busi_title','$category')";
$queryj=mysqli_query($connecti,$sqlj);
if(mysqli_num_rows($queryj)>0){
..............................
..............................
}else{
foreach ( $res["matches"] as $doc => $docinfo ) {
................................
...............................
}
}
MATCH() AGAINST()
正在给出错误,因为它应该是。在这种情况下如何使用该链接的技巧。我不知道该@word:=
链接的用途。
提前致谢。