Last post Jan 05, 2017 03:28 AM by Eric Du
Jan 03, 2017 10:45 AM|DDNaidu|LINK
I want to store Multiple images..,I want to Inserting a Apartment data in Database Same time i want to insert Multiple Images on one row id ..how its possible...??
and How to Retrive From Database Those Images...??
Jan 03, 2017 12:02 PM|PatriceSc|LINK
You would rather create a child "image" table so that you can store 0 to n images for each row id in your main table:
https://code.tutsplus.com/articles/sql-for-beginners-part-3-database-relationships--net-8561 (and scroll down to "One to Many", ie you would use "Appartments/Images" rather than "customers/orders").
Dépends on how it is stored. It will be always based on HTML anyway so it will be a link to a location (it can be the actual location for your image, if you store just the path, it could be also a page that retrieves the file from a location which is not
directly available to the web or that retrieve the blob from a db and send then this content to the browser (as it would happen for a file ie on the browser side it doesn't make any real difference).
Try to ask a single question at the time especially if you are just starting and needs detailed explanations. First, is this ok with your main/child table structure? (not sure but I have seen already the same question recently, is it you? Do you get the
approach for handling this?)
Your main table will have an ApartementId column.
Your image table will have an ImageId column and another column will tell to which ApartementId belongs this image. As a result for each apartementId you'll be able to store 0 to n images...
Jan 04, 2017 08:29 AM|Eric Du|LINK
According to your description, I think this problemis divided into two cases:
1. if your photos have a fixed number, you could add multiple columns on the table, design table like this:
ApartmentID ApartmentName ApartmentAddress ApartmentImage1 ApartmentImage2 .............
2. if you don't have a fixed number, I agree with PatriceSc's reply, you need add a children table to load images, you can design table like this, then set main key and foreign key.
ApartmentID ApartmentName ApartmentAddress
I think PatriceSc provided link is a good tutorial to operate it, please refer to this link.
Jan 04, 2017 01:22 PM|DDNaidu|LINK
I agree Your Answers But My Doubt is
1.Admin will Enter Apartment all Details Like Name,Rent,Amount,Conatct information...etc at the same time He need to Upload Multiple images of that apartment
after he enter all things he click Submit...I want to Store These Details In Database Table
2.And i want to Retrive Multiple Images from Database i want to show in Front End
This is the way i want.....and if i create child table how can i upload mulltiple images and this apartment data at once....??
Jan 05, 2017 03:28 AM|Eric Du|LINK
According to your description, as far as I know, you could execute two commands in one button click event, I think this a easy solution, please try to these steps:
1. you could insert apartment information(except images) into table1, this is the first command.
2. query this record id, then insert multiple images into table2(images table) where id equal to this record id.