I can't get sql's "match against" to work.

I thought I understood how to do this, except when I actually used sql's match (...) against (...) syntax, I got an error. This error doesn't say anything, only

"Fatal error: in /home/jharvard/vhosts/pset8/includes/functions.php on line 57".

Here is the code I am using in my search function:

$places = [];
$rows = query("SELECT * FROM places WHERE MATCH (country_code, postal_code, place_name, admin_name1, admin_name2, admin_name3) AGAINST (?)", $_GET["geo"] . "*");

I was trying this: PSET8 - MASHUP : Can't find FULLTEXT indexes when using WITH QUERY EXPANSION.

But that didn't work.

Is my syntax correct?

Thank you.


MATCH AGAINST is working, but it doesn't accept wildcards.

When I add "*" or "%" to the end of place that the user typed, it just ignores them. It doesn't match against any more rows.

So when I type "toront" into the search box, "toronto" doesn't show up.

Why is this? Where are the wildcards supposed to be used?

1 Answer 1


Instead, try AGAINST (?)", Also, you must have a FULLTEXT index across all the columns in your query and include no other columns in that index. This index is created in the database, not coded in any file.

If this answers your question, please click on the check mark to accept. Let's keep up on forum housekeeping. ;-)

  • I want to use wildcards to show results in the cases that the user didn't finish typing. How do I do this?
    – David
    Dec 5, 2015 at 22:10
  • So it turns out that the wildcards go into query() as part of the parameters being escaped.
    – David
    Dec 6, 2015 at 2:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .