I am writing a code prepared request:
$queryMask = "SELECT (`id`, CONCAT(?) AS NAME, MATCH(?) AGAINST(?) AS RELEV) FROM `table` WHERE MATCH(?) AGAINST(?) ORDER BY RELEV DESC"; // подготавливаем запрос $this->stmt = $this->db->prepare($queryMask); if (!($this->stmt)) throw new SearchException(3, "Error set prepare request: ".$this->db->error);
And the output throws an exception:
Error set prepare request: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS NAME, MATCH(?) AGAINST(?) AS RELEV) FROM `table` WHERE MATCH(?) AGAINST(?) O' at line 1.
I already broke my whole head, I don’t understand what he doesn’t like?
UPD # 1: The joke is that the view request
SELECT `id`, CONCAT(`rusname`, ' (',`origname`,') [',`year`,']') AS NAME, MATCH(`rusname`,`origname`,`year`) AGAINST('>(+пира +моря +свет) (пира* моря* свет*)' IN BOOLEAN MODE) AS RELEV FROM `films` WHERE MATCH(`rusname`,`origname`,`year`) AGAINST('>(+пира +моря +свет) (пира* моря* свет*)' IN BOOLEAN MODE) ORDER BY RELEV DESC;
passes without problems. Magic.
UPD # 2: It seems still not my day. I solved the problem by using a simple and native query (), but I decided to score on all kinds of fashionable troubles like prepare (), because it is not clear what it needs.