Answer the question
In order to leave comments, you need to log in
How to organize the storage of cities in the database?
It is necessary to bind user accounts to cities, so that later it would be possible to make requests for a specific locality.
When registering, you need to specify the city, for autocompletion, I can use the Kladr database ( https://kladr-api.ru/examples) , but how to validate on the server?
Let's say I have a table with cities, I will bind the user to them. But how to complete this table? Or should I initially have a table with all settlements?
Answer the question
In order to leave comments, you need to log in
The list of cities (well, let's say, regions) is one table...
In the table where the list of users is located, add another column (for example, ' city ' ) and specify the city id from the city list table there ...
With a SQL query, I think that won't be a problem???
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question