If I search for 02138 in the search box of my mashup I do get a match but when I click on that match the map just go blank. Can anyone please tell me why I ma having this problem?

enter image description here


ok have figured out that the array places created in search.php is used by the function search in script.js. This function is than called by configure and this helps in displaying the map by the help of longitude and latitude of the selected place. I was using the query $rows = CS50::query ("SELECT * FROM places WHERE MATCH(postal_code, place_name, admin_name1, admin_code1) AGAINST (?)", $geo); to get this json array enter image description here

after realizing that the array had no values of longitude or latitudes when I try to add longitude and latitude in my sql query then I am getting this error

Fatal error: Can't find FULLTEXT index matching the column list in /home/ubuntu/workspace/pset8/vendor/library50-php-5/CS50/CS50.php on line 352

Why am I getting this error and how to get rid of it?

My non working search.php code


require(__DIR__ . "/../includes/config.php");

// numerically indexed array of places
$places = [];

// TODO: search database for places matching $_GET["geo"], store in $places
$geo = $_GET["geo"];

$rows = CS50::query ("SELECT * FROM places WHERE MATCH(postal_code, place_name, admin_name1, admin_code1, latitude, longitude) AGAINST (?)", $geo);

foreach($rows as $row)
    $places [] = ["postal_code" => $row["postal_code"],
                  "place_name" => $row["place_name"],
                  "admin_name1" => $row["admin_name1"],
                  "admin_code1" => $row["admin_code1"],
                  "longitude" => $row["longitude"],
                  "latitude" => $row["latitude"]]; 

// output places as JSON (pretty-printed for debugging convenience)
header("Content-type: application/json");
print(json_encode($places, JSON_PRETTY_PRINT));



Did you set up a FULLTEXT index for the exact columns you want to include yet?

If you have already set up a FULLTEXT index with just postal_code, place_name, admin_name1, admin_code1 then you might need to drop that index and recreate it with the columns you want to include.

You may find these tutorials helpful. Especially this one, which tells you how to do it from the mysql50 shell prompt.

By the way, you seem to be making great progress!

Out of all the Problem Sets, "Mashup" is the one that is probably most like the experience of doing a professional website for a client. You'll have some list of features you need to deliver, and you'll find some existing code that does something like that.

In order to get the pieces together you'll need to read a ton of documentation in a very short amount of time, and you'll feel like your head is going to explode.

The upside is that if you can absorb the new information quickly, you'll generally end up writing less code and getting the job done faster -- and the next time you approach a similar problem, you'll have more familiar tools at your disposal!

  • I had the FULLTEXT on postal_code, place_name, admin_name1 and admin_code1,I managed to add the longitudes and latitudes by passing in another query with in the foreach loop and referencing it to the id of the current row. Havent read the tutorial you provided, my head is already exploding with so much of documentaions to read. Are these tutorials absolutely necessary to read to proceed further in this problem set? would really appreciate if u let me know cuz Im kind of thinking to first finish this pset then read the extra stuff, Marking the answer helpful in the meantime Oct 14 '16 at 6:25

You must log in to answer this question.

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