Forums

This topic is locked

Displaying an image based on database field

Posted 09 Feb 2005 01:15:06
1
has voted
09 Feb 2005 01:15:06 Roger Smithe posted:
Hi,
I am writing a video inventory with links to the IMDB (Internet Movie DataBase)
The language is set to javascript and the database is FoxPro v8

What I an trying to do is detect whether an IMDB URL reference exisits in the database
column IMDB. I want to display a small image which will pass the URL for
that particular movie to the IMDB thru a browser.

The last line does that with the label "IMDB" when links to the IMDB website but
I want an image display if the column contain an IMDB URL.

I've added a column to the database that adds a Yes/No field just to try it but
that doesn't work either. Eventually I just want it to read whether there's a URL
in the column and display the image for the link. No URL no link.

<tr>
<td><div align="right"><strong>IMDB:</strong></div></td>
<td><%=RecordSet1.Fields.Item("imdb".Value %> </td>

<% IF (RecordSet1.Fields.Item("IMDBN".Value = "True" THEN %>
<td><img src="images/imdbMark.gif" width="10" height="10"></td>
<% Else %>
<td><img src="images/Blank.gif" width="10" height="10"></td>
<% End If %>

<td><a href="<%=RecordSet1.Fields.Item("imdb"%>">IMDB</a></td>
</tr>

The error I get is:
Technical Information (for support personnel)

* Error Type:
Microsoft JScript compilation (0x800A03EC)
Expected ';'
/winwebdesign/video/videoSearchRecord_details.asp, line 98, column 50
IF (RecordSet1.Fields.Item("IMDBN".Value = True) THEN
-------------------------------------------------^


Dreamweaver MX 2004 v7.01
Windows XP SP-2
FoxPro v8
<font face='Arial'></font id='Arial'><font size=4></font id=size4>

Edited by - alpha1138 on 09 Feb 2005 02:13:21<b></b><b></b>

Edited by - alpha1138 on 09 Feb 2005 02:14:30<b></b>

Edited by - alpha1138 on 09 Feb 2005 02:15:09

Edited by - alpha1138 on 09 Feb 2005 02:16:03

Replies

Replied 09 Feb 2005 12:49:39
09 Feb 2005 12:49:39 Simon Martin replied:
As you say you should be able to simply test to see whether or not the record contains an entry for the url...
All you need to do is use the dynamic image for the bit between the &lt; a&gt; tags
&lt;% If rsVideo.Fields.Item("url".Value &lt;&gt;"" Then %&gt;
&lt;a href="&lt;%=RecordSet1.Fields.Item("imdb"%&gt;"&gt;&lt;img src="images/imdbMark.gif" width="10" height="10"&gt;&lt;/a&gt;
&lt;% Else %&gt;
&lt;img src="images/Blank.gif" width="10" height="10"&gt;
&lt;% End If %&gt;

Live the life you love
Love the life you live
~ ~ ~ ~ ~ ~ ~
<b>Simon Martin</b> - <i>DMXzone Manager</i>
<font size=1>[ Dreamweaver MX/MX2004 | ASP | SQL | XHTML/CSS | Web Accessibility ] </font id=size1>
Replied 10 Feb 2005 18:31:30
10 Feb 2005 18:31:30 Roger Smithe replied:
Simon Martin
I redid the page with an Access database and VBSCRIPT.
That worked just fine like it should have in the first place.
Thanks for your help.

BTW Whats with all the space in names displaying as non breaking spaces
(I'm using Firefox)
Replied 10 Feb 2005 22:25:45
10 Feb 2005 22:25:45 Simon Martin replied:
Yeah the & nbsp in names is a known bug in the version of the snitz forum that we're using here.
There have been a few other posts asking about this too - but the forums are being revamped at the moment so it should be resolved soon

Live the life you love
Love the life you live
~ ~ ~ ~ ~ ~ ~
<b>Simon Martin</b> - <i>DMXzone Manager</i>
<font size=1>[ Dreamweaver MX/MX2004 | ASP | SQL | XHTML/CSS | Web Accessibility ] </font id=size1>

Edited by - ganseki on 10 Feb 2005 22:26:18

Reply to this topic