Jump to content

[SOLVED] Wanting to upload an album then add pics then retireve


nade93

Recommended Posts

Hi All

 

I am wanting a really simple code that allows me to upload an album name to the database (table is already set up "albums") and then add pics to this album so that they can be called via php. It will only be the image pats the pics will go into a directory.

 

So What i am needing is:

- SELECT * from albums JOIN ...... is this on the right lines, if so what would i need?

- INSERT into when i insert the pics, how to I automatically join the album to the picture?

 

There are lots of over complicated gallerys out there, i am just needing to store the data for now and have a really simple for. If you one can helpt that would be great and much appreciated!

 

thanks

 

Link to comment
Share on other sites

Well you need another table to map the pictures to the album.

So create a "pictures" table, and have the id of the album as a field.

e.g.

Included is some sample data of what it might look like.

Pictures
==========================================
pic_id | album_id | filename
==========================================
1      | 1        | /images/pictures/album_id1/blah.jpg
2      | 1        | /images/pictures/album_id1/summit.jpg

 

Then to retrieve the pictures for an album (#1):

SELECT *
FROM albums a
JOIN pictures p ON a.album_id = p.album_id
WHERE album_id = 1

 

Hope that helps or points in the right direction.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.