Skip to main content
Participating Frequently
August 25, 2011
Question

Uploading multiple images to the same record in a database.

  • August 25, 2011
  • 12 replies
  • 3155 views

Hello all,

I am new to PHP and MySQL and I am using Dreamweaver to help make the coding process a whole lot easier. I have a client who owns a car lot and I have 99% of his website complete. The only outstanding item is, he needs to be able to upload multiple images for one car. As of right now, his MySQL database is set up with one table that has carid, make, model, year, mile, etc., all the way down to image_path which is a varchar field with a value of 100. I have tried using the Dreamweaver Developer toolbox, but I am completely lost on how to make this happen. I know that in order for this to happen I need to be able to update the image_path field (which points to an image path on my server that contains the images) in the database and I am aware of how to make update records with Dreamweaver but for some reason this one just isn't working out for me. If someone could help me out I would be very grateful.

This topic is closed to new replies. Start a new post to keep the conversation going.

12 replies

Participating Frequently
August 28, 2011

Ok, I have changed the name in the images table from image_path to imagename. Is there any possibility that I could pay you to create this code for me? I do not have enough knowledge about this to do it successfully and time is ticking before I reach the project deadline.

Participating Frequently
August 25, 2011

>As of right now, his MySQL database is set up with one table

For starters, you will need another table that stores the image paths for each image related to each vehicle. This table will have a foreign key to the main vehicle table.

Participating Frequently
August 25, 2011

I have also read this as a solution, but the problem is I am unsure how to make foreign keys with the type of MySQL server I have (MyISAM). If it were possible I would have two tables, 1 table for carinfo with carid as the primary key. The second table has a primary key of imgid and a foreign key off carid that links to the carid in the carinffo table, am I correct in saying this?

Rob Hecker2
Legend
August 25, 2011

You can achieve this with a third table that contains just the auto increment ids of the other two tables.So this third table is what would be updated when you add an image to a particular auto record