Another query quandary
Once again because of my clients poor database design I need help trying to solve a puzzle.
Instead of having a separate Images table linked to the Item table, we have 11 image columns in the Item table AND 11 thumbnail columns.
(looks like this:
ID | ItemName | Image1 | Thumb1 | Image2 | Thumb2 | Image3 | Thumb3 | etc.
This would actually work if each line item had 11 images but they don't. So what happens is most pages end up having broken images. I put a band-aid on it by creating a "No Image" image and displaying that for now. Tacky but better than it was.
Create a query (and/or php) that allows me to use only one <img src> instance and repeats itself if an image is found in the next image column and so on. This way some pages may have 10 thumbs and others may only have 2 or 3. Hopefully that makes sense.
I've tried several lightbox and image viewer scripts but all of them just create slide shows from images in a directory. I need this to be dynamic.
I appreciate all advice of how to do this or better suggestions.