Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在编写全文搜索查询时遇到问题。这是我的代码:
SELECT * FROM fruits WHERE MATCH (color) AGAINST (:term IN BOOLEAN MODE)
执行该查询时我没有得到任何结果,但是当我像这样对术语进行硬编码时,
SELECT * FROM fruits WHERE MATCH (color) AGAINST ('yellow' IN BOOLEAN MODE)
我得到一些结果。我想我需要用一些连接来重写冒号部分。谢谢
不,分号不需要连接。 您只需要在运行原始查询的完全相同的表上测试您准备好的语句版本。
您是否将值绑定到:term
:term
$stmt = $conn->prepare(SELECT * FROM fruits WHERE MATCH (color) AGAINST (:term IN BOOLEAN MODE)); $stmt->bindValue(":term", "yellow"); $stmt->execute();