close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Another query quandary

Thread began 9/14/2011 3:38 pm by Jared Lui | Last modified 9/14/2011 6:40 pm by Jared Lui | 767 views | 2 replies |

Jared Lui

Another query quandary

Once again because of my clients poor database design I need help trying to solve a puzzle.

DATABASE DESIGN
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.

PAGE DESIGN
On the Item Details page we are displaying the large view of the first image. And originally the page had 10 hard coded places for the remaining 10 images displaying the thumbs and using a javascript displaying the full size images onclick.

ISSUE
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.

MY GOAL
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.

Sign in to reply to this post

Jason ByrnesWebAssist

you wont be able to create one image and loop it for each image field, you will need to create all 10 images on the page, but you can put an if statement around each one so that it will only actually display on the page if the column is not empty. for example:


php:
<?php if($row_recordsetName['imagecol1'] != "") { ?>

<img  src="path/to/images/<?php echo $row_recordsetName['imagecol1']; ?>" />
<?php ?>
<?php 
if($row_recordsetName['imagecol2'] != "") { ?>
<img  src="path/to/images/<?php echo $row_recordsetName['imagecol2']; ?>" />
<?php ?>
etc.....
Sign in to reply to this post

Jared Lui

Sweet!

Thanks Jason!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...