Create two tables for easy, one for images and the other for products and you can associate the image id with the product id.
Here I will put just one example,you do not need to take as a basis,it is simply for you to have a notion.
First create a table to store the images :
create table images (
image_id tinyint(3) not null AUTO_INCREMENT,
image_type varchar(25) not null ,
image blob not null,
image_size varchar(25) not null,
image_ctgy varchar(25) not null,
image_name varchar(50) not null
);
After that, create a product table (I’ll just put the product id just for example) :
create table products (
products_id int not null AUTO_INCREMENT
);
After this you can associate with the products table the image id with the product id :
select image_id from images join products on images.image_id = products.products_id;
Note: In the Internet you put if you want where
to make a condition for these associations.
Create a single table for the images and you identify it by product id
– user28266
Complementing with the comment above, you create two tables, one for the product and one for the images, associate each image to the product id, so each product can have as many images as needed.
– Pedro Franco
Thank you!
– Leonardo Silva