Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在mysql中使用搜索文本索引时出错_Php_Mysql - Fatal编程技术网

Php 在mysql中使用搜索文本索引时出错

Php 在mysql中使用搜索文本索引时出错,php,mysql,Php,Mysql,我有一个使用全文的2表 test1(id, name1, description1) test2(id, name2, description2, test1_id) 还有一个问题 Select a.name1, b.name2 From test1 as a, test2 as b Where a.id = b.test_1id And MATCH(a.name1, a.description1, b.name2, b.desciption2) AGAINST ("%searchstri

我有一个使用全文的2表

test1(id, name1, description1)
test2(id, name2, description2, test1_id)
还有一个问题

Select a.name1, b.name2 From test1 as a, test2 as b 
Where a.id = b.test_1id 
And MATCH(a.name1, a.description1, b.name2, b.desciption2) AGAINST ("%searchstring%")
结果是mysql无法运行,我想匹配错误…,b.name2,b.description2,如何修复?谢谢

不是针对%searchstring%的,应针对“%searchstring%”

用单引号替换双引号

下面是通常使用的查询

SELECT * FROM articles
WHERE MATCH(title, body) AGAINST ('PHP')
更新1 我发现a.id=b.test\u 1id的位置有问题

我认为a.id=b.test\u 1id应该是a.id=b.test1\u id

在查询中,您有test\u 1id而不是test1\u id。请检查这是否是您的问题


祝你好运

我认为您在where条件下有一个错误:

其中a.id=b.test_1.id b是表test2的别名,但字段名不应包含点


将其更改为正确的字段名称,它应该可以工作。

引号没有任何区别请告诉我您打印的内容searchstringcheck我的更新答案,如果问题仍然存在,请告诉我…@FahimParkar:我已编辑了问题,结果未显示,错误在匹配中…,b.name2,b.description2执行时是否会得到一些信息从test1中选择a.name1,b.name2作为a,test2作为b,其中a.id=b.test\u 1id??a.id=b.test\u 1id也不正确。。。它应该是a.id=b.test1\u id