|
Avoid writing multiple queries especially if you need to loop them.
Are these images only ever available in one gallery? Given null entries here, that indicates that there is something not correct with the design which will cause problems later. A simpler approach would be to create a table with a galleryid and imageid and create a composite of these. A third table with the gallery information is used, but only necessary if specific information is applied. This lets you create the many to many should an image reside in more than one gallery and provides an easy to join column. Mostly software to require enforcement of sizes though since you can't enforce it to contain <= 15 from the storage side.
|