Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Dispay Code Syntax Error

Status
Not open for further replies.

Webflex

Technical User
Apr 20, 2001
101
GB
Hi

I'm trying to pull an image reference held as a text field in an access database and display it, code of the page is below.


Code:
<%
option explicit
dim useraction
dim dsn,sql,conn,rs,flag,color,x
dim fname,lname,tel,mobile,init,dept,id,image
id=request(&quot;id&quot;)
useraction=request(&quot;action&quot;)
dsn=&quot;DBQ=&quot; & Server.Mappath(&quot;../db/picphone.mdb&quot;) & &quot;;Driver={Microsoft Access Driver (*.mdb)};&quot;
set conn=server.createObject(&quot;adodb.connection&quot;)
conn.open dsn
select case useraction
case &quot;display&quot;
sql = &quot;select * from users where id=&quot;&id
set rs = conn.execute(sql)
lname=rs(&quot;lname&quot;)
fname=rs(&quot;fname&quot;)
tel=rs(&quot;tel&quot;)
mobile=rs(&quot;mobile&quot;)
init=rs(&quot;init&quot;)
dept=rs(&quot;dept&quot;)
image=rs(&quot;image&quot;)


	if rs.eof and rs.bof then
		response.write &quot;No Record Found&quot;
	else
		response.write &quot;<table width=550 border=0 align=left><th align=left>Last Name</th><th align=left>First Name</TH>&quot;
		response.write &quot;<th align=left>Tel</TH><th align=left>Mobile</TH><th align=left>Initials</TH><th align=left>Dept</TH>&quot;
		response.write &quot;<th align=left>Picture</TH>&quot;
		do while not rs.eof
		if flag=0 then
			flag=1
			color=&quot;#DFEFFD&quot;
		else
			flag=0
			color=&quot;#DDEOE3&quot;
		end if

		response.write &quot;<TR bgcolor=&quot;& color & &quot;><TD>&quot;
		response.write RS(&quot;lname&quot;) & &quot;</td><td>&quot; & RS(&quot;fname&quot;) & &quot;</td><td>&quot; 
		response.write RS(&quot;tel&quot;) & &quot;</td><td>&quot; & RS(&quot;mobile&quot;) & &quot;</td><td>&quot; & RS(&quot;init&quot;) & &quot;</td><td>&quot; 
		response.write RS(&quot;dept&quot;) & &quot;</tr></td>&quot;
response.Write &quot;<img Src=&quot;&quot; & image & ></img></tr></td>&quot;[/code]
rs.movenext
x=x+1
loop

'response.write &quot;<tr><td colspan=7>Total Records : &quot; & x & &quot;</table>&quot;

rs.close
conn.close
set conn=nothing
end if

set conn = nothing
%>

<%end select%>


<head>
<LINK REL=STYLESHEET HREF=&quot; TYPE=&quot;text/css&quot;>
<style>
a:hover{color:red}
</style>
<title>Image Page</title>
</head>
[/code]

The problem is the returned article gives this

Code:
<table width=550 border=0 align=left><th align=left>Last Name</th><th align=left>First Name</TH><th align=left>Tel</TH><th align=left>Mobile</TH><th align=left>Initials</TH><th align=left>Dept</TH><th align=left>Picture</TH><TR bgcolor=#DFEFFD><TD>Surname</td><td>FirstName</td><td>Extn</td><td></td><td>IHI</td><td>IT</tr></td><img Src=&quot; & image & ></img></tr></td>


<head>
<LINK REL=STYLESHEET HREF=&quot;[URL unfurl="true"]http://urllocation/style/csog.css&quot;[/URL] TYPE=&quot;text/css&quot;>
<style>
a:hover{color:red}
</style>
<title>Image Page</title>
</head>

displaying the red X of no image even if the image resides in the same folder as the database, I can worry about paths later I just want to get the image display working.

TIA
 
Your quotes are wrong, try this:

response.Write &quot;<img Src=&quot; & &quot;&quot;&quot;&quot; & image & &quot;&quot;&quot;&quot; & &quot;></img></tr></td>&quot;

 
Excellent, many thanks - I hate those blinking quotes, I keep doing this - should have thought it through.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top