Information site module

Please tell me the concept of a module. You need to make a search module for bus routes. There is a field of departure and a point of destination. When entering in the field, when typing the first letters, all possible cities are displayed. What can be used to make this feature?


Answer 1, authority 100%

For example:

Route table: id, number num, name name etc

Table of stops: id, route mid, name name, city city [, x/y coordinates] etc

Well, according to the request, we are looking for a route that has a start and end point, something like

SELECT m.*
  FROM marshrut as m
  JOIN points as p1 ON p1.mid = m.id
  JOIN points as p2 ON p2.mid = m.id
WHERE
  p1.city = 'Moscow' AND
  p2.city = 'NewYork'
;

Selecting a city by the first letters is banal, google it) Yes, at least google the algorithm of Google prompts))

// : ... WHERE city LIKE 'Mos%';