If title is: $title = wp_title(”,0); – query does not exclude: AND posttitle <> ‘$title'”
If title is for example: $title = ‘test is the best’; – query does exclude AND 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'");
You have a typo –
posttitledoesn’t need single quotes, use:Putting single quotes indicates to SQL that it’s dealing with a string, not a column reference. So the comparison to your variable was that it didn’t equal the string ‘posttitle’, rather than the value in the column.
In MySQL, backticks (`) are used for escaping registered keywords: