Forums

ASP

This topic is locked

If Image Exists

Posted 13 Nov 2003 15:02:43
1
has voted
13 Nov 2003 15:02:43 Matt Jukes posted:
Hi,

I guess this is simple really. I have a DB and each entry has an image. The Images are named xxx.jpg where xxx is the autonumber ID of each db entry.
so the first image is 1.jpg, 2.jpg and so on. I have been trying to write some code that if the image for the entry does not exist then a default image would be displayed. I see alot of fileExist commands but they all seem to be for uploading and this is only linked to a basic search/results page, so I'm a little lost.

Any Ideas? Any help would be great but no worries<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Thanks
Matt

Replies

Replied 15 Nov 2003 13:17:22
15 Nov 2003 13:17:22 Dave Thomas replied:
<pre id=code><font face=courier size=2 id=code>&lt;%Dim PicShow
PicShow = rsYourRecordset.Fields.Item("PicID".Value
IF PicShow &lt;&gt;"" THEN%&gt;
&lt;img src="&lt;%=PicShow%&gt;"&gt;
&lt;%ELSE%&gt;
&lt;img src="pix/no_pic.jpg"&gt;
&lt;%End If%&gt;
</font id=code></pre id=code>

that should do it

Regards,
Dave

UD4 | Flash 5/MX | Studio MX | SQL | Access | ASP/VBScript | XP-Pro

Reply to this topic