简体   繁体   English

使用 MySQL 相关性的搜索引擎开发,不适用于 PHP

[英]Search Engine Developement using MySQL relevancy, not working on PHP

i'm working on search engine developement.我正在从事搜索引擎开发。 I'm kinda struggling with an SQL/PHP request.我有点在处理 SQL/PHP 请求。 I'm trying to get the highest relevancy score from a search query.我正在尝试从搜索查询中获得最高的相关性分数。 It works perfectly on SQL, but not at all on PHP, neither on localhost nor online (while the source code is generated by phpmyadmin itself).它在 SQL 上完美运行,但在 PHP 上完全不工作,无论是在本地主机上还是在线上(而源代码是由 phpmyadmin 本身生成的)。

    $connect = mysqli_connect('a', 'b','c','d');    
    $sql1 = "SELECT job, MATCH (job)  AGAINST (\'sales representative\' IN BOOLEAN MODE) AS score FROM general_comp ORDER BY score DESC limit 1";
    $result = mysqli_query($connect, $sql1); 

    echo $result;

Obviously SQL connection works, since other requests are working very well.显然 SQL 连接有效,因为其他请求运行良好。 Any idea?任何想法?

Source = https://dev.mysql.com/doc/refman/8.0/en/fulltext-boolean.html来源 = https://dev.mysql.com/doc/refman/8.0/en/fulltext-boolean.html

You need to fetch the results from the resource $result :您需要从资源$result获取结果:

$connect = mysqli_connect('a', 'b','c','d');    
$sql1 = "SELECT job, MATCH (job)  AGAINST (\'sales representative\' IN BOOLEAN MODE) AS score FROM general_comp ORDER BY score DESC limit 1";
$result = mysqli_query($connect, $sql1); 
$row = mysqli_fetch_assoc($result);
print_r($row);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM