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

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.