How can I search in MySQL with FULLTEXT index?

You need to search the database, which contains ZIP codes and cities. In phpMyAdmin all fields, specify the FULLTEXT index, the search is performed in the following way:
<?php
 require(__DIR__ . "/../includes/config.php");
 $places = [];
 $places = CS50::query("SELECT * FROM places WHERE MATCH(postal_code, place_name) AGAINST (?)", $_GET["geo"]);

 header("Content-type: application/json");
 print(json_encode($places, JSON_PRETTY_PRINT));
?>

Page search display. The string in $_GET, you can insert a index of cities and name of cities, respectively the database, but no options work. At "/home/ubuntu/workspace/pset8/vendor/library50-php-5/CS50/CS50.php on line 352" is only the output of the error:
$statement = $handle->query($query);
 if ($statement === false)
{
 trigger_error($handle->errorInfo()[2], E_USER_ERROR);
 }
July 8th 19 at 16:46
1 answer
July 8th 19 at 16:48
Solution
No indexes on any of the fields listed in math,
learn to read what writes the error handler helps a lot.

UPD: good article on FTS
They are everywhere, wherever may be: https://dl.dropboxusercontent.com/u/18694444/index... - meda37 commented on July 8th 19 at 16:51
: make export the table structure to see what fields you have included in FTS. Poke the "create index" in phpMyAdmin not the best way to create an index, also nifiga not guaranteed. - lily.Kozey commented on July 8th 19 at 16:54
: I tried to re-create the table using FULLTEXT KEY `fulltext` (`postal_code`,`place_name`,`admin_name1`,`admin_name2`,`admin_name3`) and then filled in all the data - the result is the same. - meda37 commented on July 8th 19 at 16:57
in General, once again, recreate the table and it worked. Wonders what is. In any case, thanks for the help. - meda37 commented on July 8th 19 at 17:00
: have you read the article though, if we dokumentaciju difficult. You create a SINGLE key for all the fields, then either specify all the fields included in the index and search all fields, or create separate keys on fields. - lily.Kozey commented on July 8th 19 at 17:03

Find more questions by tags JavaScriptMySQLPHP