nade93 Posted February 10, 2009 Share Posted February 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/144606-solved-wanting-to-upload-an-album-then-add-pics-then-retireve/ Share on other sites More sharing options...
aschk Posted February 10, 2009 Share Posted February 10, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144606-solved-wanting-to-upload-an-album-then-add-pics-then-retireve/#findComment-758813 Share on other sites More sharing options...
nade93 Posted February 10, 2009 Author Share Posted February 10, 2009 your my hero! Quote Link to comment https://forums.phpfreaks.com/topic/144606-solved-wanting-to-upload-an-album-then-add-pics-then-retireve/#findComment-758815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.