Answer the question
In order to leave comments, you need to log in
How to retrieve images from database?
There are 10 pictures on the site. it is necessary to display several pictures for each product from the database.
Pictures will be displayed for some products are the same.
For example, for product 1, pictures 1 and 2. For product 2, pictures 1 and 3.
Table with pictures: Images
ID img_id Img
1 1 1.png
2 1 2.png
3 2 3.png
ID product_id images_numb
1 1 1,2
2 2 1,3
Answer the question
In order to leave comments, you need to log in
Adding Egor Skorokhodov to the answer , if you really don’t want to work with ManyToMany models, there is an easier way (as a patch is suitable, but in the future it will be worse).
SQL has such a thing - FIND_IN_SET and you can use it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question