Just to give a background, I'm using Sphinx to do searches via PHP/MySQL. This is run through the system we have. Here is the SQL statement in question:
select * from [TABLE_NAME] where match('@keywords "homeschooling"') and status = 3 order by rand() limit 25
I'm getting this error with the said statement:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
However, if I use that exact statement and run it by itself, it does work! So I'm not sure what the problem is.
To recap, SQL statement does not work and returns an error when run via the system but it works when run by itself.
Hope someone can help.
Thanks!
Sphinx, or SphinxSE , doesn't use the full text search syntax of MySQL.
After creating a Sphinx engine table:
CREATE TABLE t1
(
id BIGINT UNSIGNED NOT NULL,
weight INTEGER NOT NULL,
query VARCHAR(3072) NOT NULL,
group_id INTEGER,
INDEX(query)
) ENGINE=SPHINX CONNECTION="sphinx://localhost:9312/test";
The query part of the string corresponds to the sphinx syntax for searching:
SELECT * FROM t1 WHERE query='test it;mode=any';