Answer the question
In order to leave comments, you need to log in
What is the best way to do and is it worth using Enum/Set?
The essence of the problem. There are materials - which should be displayed only in selected cities.
When saving, we specify where they are displayed.
Cities to choose from: Moscow, Kazan, Ufa, Beijing, or all cities.
You can choose - several cities, or even all cities.
Task: how to store data about the city in the database, so that in the future, in one request, display all related materials.
PS A variant of a separate table - where to store information about the selected cities is postponed for now, since there will be a lot of records.
Thank you all in advance for your thoughts!
UPD
Cities are presented as:
Moscow - 1
Kazan - 10
Ufa - 100
Beijing - 1000
And an array of possible pairs for each city is created, which is the sum of the bindec() values.
That is, for the material that should be displayed in Moscow and Kazan, there will be 11 => 3.
It is still difficult to say how much more productive it is - a little later I will do a test and unsubscribe here.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question