问题:
我试图在我的 SQL 搜索查询中使用全文索引,但由于某种原因,它不会从数据库中返回任何帖子。
PHP/SQL 代码:
$string = mysql_real_escape_string($_POST['searchtext']);
$query = "SELECT
EID,
CONCAT (u1.Firstname, ' ', u1.Lastname) AS Examiner,
Supervisor,
ExaminationDate,
FirstAuthor,
SecondAuthor,
Level,
Credits,
Completed
FROM betyg_essays grade
INNER JOIN betyg_users u1 ON grade.Examiner = u1.UID
WHERE
MATCH (Supervisor, FirstAuthor, SecondAuthor) AGAINST ('$string')
ORDER BY
EID ASC
";
MySQL 表定义:
数据库中包含两个帖子的列:
设想:
如果我只搜索“per”,它应该返回第二个帖子。