I am relatively new to PHP/MySQL and have been having a problem that I cannot figure out. I’ve scoured this site but cannot find any information.
My problem is very simple: How to associate an uploaded image file with a pre-existing album.
I have 2 separate tables in my database: one for albums and one for images. What I want to do is have an <option> drop down menu retrieving the user’s pre-existing albums thus assigning an albumID to the image database.
I have successfully populated a drop down box with the user’s albums, but cannot figure out how to insert the selected ID into the picture table albumid.
Any help would be much appreciated. Thank you!
When you selectd album from drop down, you could reload the page, adding the album ID in the URL. Then you only need to use
$_GETto get the album id.Then, when you upload the image, in your
upload.phpfile, you use the$_GETto retrieve the album ID.Once you have successfully moved the image from the upload temp directory to it’s final location, add the image URL to the image table and retrieve last inserted row ID. Take this ID and insert it into album table.
Does that answer your question? 🙂