Mysql匹配查询问题

时间:2010-11-22 19:31:24

标签: sql mysql

自然语言全文搜索 我使用mysql Match功能。怎么了?

$ititle = wp_title('',0,'');


$query = mysql_query("SELECT posttitle, posturl, siteurl MATCH (posttitle, posturl, siteurl) AGAINST $ititle AS score FROM interlinks WHERE MATCH (posttitle, posturl, siteurl) AGAINST $ititle AND title <> $ititle");

TY

2 个答案:

答案 0 :(得分:0)

您需要在AGAINST条件中的变量周围添加括号和引号。

AGAINST ('$ititle')

答案 1 :(得分:0)

搞定了,这是代码:

$ititle = wp_title('',0,'');


$query = mysql_query("SELECT posttitle, posturl, siteurl, MATCH (posttitle,posturl,siteurl) AGAINST ('$ititle') AS score FROM interlinks WHERE MATCH (posttitle,posturl,siteurl) AGAINST ('$ititle')");