简体   繁体   English

如何将未知数量的图像存储到 MySQL 数据库中

[英]How to store unknown number of images into the MySQL database

I am creating multivendor ecommerce application using JAVA in android studio.我在 android studio 中使用 JAVA 创建多供应商电子商务应用程序。 I wanted to create a database to store products added by the sellers.我想创建一个数据库来存储卖家添加的产品。 Now I wanted to store images uploaded by the sellers in the database and I know very well how to that.现在我想将卖家上传的图片存储在数据库中,我非常了解如何做到这一点。 But the problem is that I don't know how many image the seller is going to upload.但问题是我不知道卖家要上传多少张图片。 Sometimes he uploads 1 sometimes 2 or 3 or 4 and so on.有时他上传 1 有时 2 或 3 或 4 等等。 Can anybody tell me how to create a code and database table to upload unknown number of images into the database ?谁能告诉我如何创建代码和数据库表以将未知数量的图像上传到数据库中?

If the user can upload multiple images, store them in a separate table如果用户可以上传多张图片,请将它们存储在单独的表中

product产品

id ID name姓名
1 1 Product A产品A
2 2 Product B产品B

product_image产品图片

product产品 image_path图像路径 sort_order排序
1 1 /path/to/image.jpg /path/to/image.jpg 1 1
2 2 /path/to/image-1.jpg /path/to/image-1.jpg 1 1
2 2 /path/to/image-2.jpg /path/to/image-2.jpg 2 2
2 2 /path/to/image-3.jpg /path/to/image-3.jpg 3 3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM