如果title是:$title=wp_title('',0);-查询不排除:并且posttitle'$title'”如果title是例如:$title='test is the best';-查询不排除并且posttitle''test is the best'' $query = mysql_query("SELECT posttitle, posturl, siteurl, MATCH (posttitle,posturl,siteurl) AGAINST ('$title') AS score FROM interlinks WHERE MATCH (posttitle,posturl,siteurl) AGAINST ('$title') AND `posttitle` <> '$title'"); (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 您有一个输入错误-posttitle不需要单引号,请使用:SELECT posttitle, posturl, siteurl, MATCH (posttitle,posturl,siteurl) AGAINST ('$title') AS score FROM interlinks WHERE MATCH (posttitle,posturl,siteurl) AGAINST ('$title') AND posttitle <> '$lowercasetitle'使用单引号向SQL表明它处理的是字符串,而不是列引用。因此与变量的比较是,它不等于字符串“posttitle”,而不是列中的值。在MySQL中,backticks(`)是used for escaping registered keywords:SELECT posttitle, posturl, siteurl, MATCH (posttitle,posturl,siteurl) AGAINST ('$title') AS score FROM interlinks WHERE MATCH (posttitle,posturl,siteurl) AGAINST ('$title') AND `posttitle` <> '$lowercasetitle'关于sql - MySQL查询错误,不等于,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4249936/ (adsbygoogle = window.adsbygoogle || []).push({});
10-09 20:22