Hi guys,
I have a problem which I'm not able to solve in any way. I'm trying to add a 'random album thumb' feature to my php photogalley.
I have two tables in mysql database: photo_albums and photos. My idea is first to:
1) select all the different album numbers from 'album_number' column of photo_albums table that are the sub albums for example album '5'. So I would get an array containing for example several album numbers like (3, 45, 67, 34 etc).
SELECT album_number FROM photo_albums WHERE album_sub=5)
2) Then I would go to 'photos' table in my database and select random photo where photo belong to one of the album numbers in array (3, 45, 67, 34 etc).
When some album has no pictuers in it, it should loop until it reaches the album number which has photos.
How could I do this? I'm quite new to php, so I desperately need your help.
Thanks in advance,
Laura
I have a problem which I'm not able to solve in any way. I'm trying to add a 'random album thumb' feature to my php photogalley.
I have two tables in mysql database: photo_albums and photos. My idea is first to:
1) select all the different album numbers from 'album_number' column of photo_albums table that are the sub albums for example album '5'. So I would get an array containing for example several album numbers like (3, 45, 67, 34 etc).
SELECT album_number FROM photo_albums WHERE album_sub=5)
2) Then I would go to 'photos' table in my database and select random photo where photo belong to one of the album numbers in array (3, 45, 67, 34 etc).
When some album has no pictuers in it, it should loop until it reaches the album number which has photos.
How could I do this? I'm quite new to php, so I desperately need your help.
Thanks in advance,
Laura
Comment