0

One of my website pages allows users to save locations that they've visited. They also have the functionality to add images for each location. The location's details are saved within a MySQL database whereas the image files are saved in a folder on my server saving the original and a thumbnail version.

I've put together the script which allows the user to upload the images, but I'm having a little difficulty in saving the images, matching them against the pertinent location.

The unique automatically incrementing field for the 'Parent (Locations)' page is called locationid so it would seem logical that this is used to link the 'Parent' and the 'Child (Image)' files.

I've done quite a bit of programming in MS Access, and I know that as soon as a value is entered into any field on the parent form, the record is created, thus giving the incremental unique id which child forms can hang off. From the knowledge I have, I think I'm right in saying that this doesn't happen when using html, php and MySQL. Here a 'submit' action needs to take place for the record to be saved.

I just wondered whether someone, who has a greater understanding of this could provide some guidancc on how I could get around this.

cdeszaq
  • 30,869
  • 25
  • 117
  • 173
IRHM
  • 1,326
  • 11
  • 77
  • 130

1 Answers1

0

In your PHP page you will need to connect to the mysql and perform an insert into the table, and retrieve the unique identifier that was generated. Here's a sample, or this one shows inserting into a parent child table.

I hope I understood and answered your question.

Community
  • 1
  • 1
JoshBerke
  • 66,142
  • 25
  • 126
  • 164