This is probably the easiest thing I have looked at all day.
First, make sure you have a 1px transparent image. I am also
assuming that you are calling your images from a file and that the
name is being pulled by a recordset from a name in your database
and that the code loops until EOF. If so, use the following code
block where your image recordset is:
<%Dim PicShow
PicShow = rsEx2.Fields.Item("shMainPic").Value
IF PicShow <>"" THEN%>
<img src="<%=PicShow%>">
<%ELSE%>
<img src="pix/no_pic.jpg">
<%End If%>
Now, I know you are probably asking, "What are we doing?"
- First we are declaring a Variable and naming it PicShow .
- Next we give PicShow a value equal to the contents of
rsEx1.Fields.Item("shMainPic").Value
- We then start our IF THEN routine by saying that IF the
contents of PicShow is not empty (<> -- not equal to "" --
empty) THEN we must execute the next line of code. Which happens to
be <img src="<%=PicShow%>"> (remember that PicShow now
holds the value of the image path)
- So what happens if PicShow IS empty? That's where the ELSE
comes in with ELSE execute the next line of code. Which happens to
be a standard HTML image path to our default image " <img
src="pix/no_pic.jpg"> "
- END IF tells the page that this particular IF THEN routine
is over!
In short ........... IF the dynamic picture field is not
empty THEN display the dynamic picture, otherwise ELSE display a
standard static picture.
Let me know if this is clear or not. Good luck and keep
coding!