0

I'm using Google Places for the first time and trying to get my head around it.

So I have a html multiple select box which the user can select from many cities using the google places drop-down and select what locations they want. The location names, e.g-'Feltham, United Kingdom' get stored in the location column in my database table. They are separated using commas.

What I want to do now is have a search bar. If the user wants to search 'Hounslow' for example which is close to Feltham, how would I query so that I get the row which has Feltham stored inside the location column in my table as it's close to Hounslow.

Just a good start or advise would be enough. I just want to see what is the way forward or if i should change my design.

I'm using PHP CodeIgniter alongside JavaScript/jQuery and MySQL

Edit:

Table X- | Column Warehouse = KMG Warehouse | Column location = Feltham,UK, Hillingdon, UK |

If the user searches Hounslow in the search box which is close to Feltham, an SQL statement would look something like:

Select * from table X where Hounslow is close to the areas in the location column. The results should return KMG Warehouse.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

You must use the coordinates (latitude and longitude). You can find the nearest points or you can specify the radius of the nearest points from the primary point

soft87
  • 482
  • 2
  • 16
  • Already saw :-) https://stackoverflow.com/questions/46505447/mysql-how-to-select-rows-where-longitude-and-latitude-is-in-array-based-on-lon – soft87 Sep 30 '17 at 18:25