Avatar of Jesse26
Jesse26

asked on 

code problem

I am trying to make this recordset have two different uses,
one that shows an image and
two i want link the image per record to a page.  

In this case The_Empire_Store_gear.asp
Here is the recordset code but it doesnt work.  Any ideas?

<a href="The_Empire_Store_Gear.asp"<img src="<%=(Recordset1.Fields.Item("Picture").Value)%>"></a></div></td>
  </tr>
Adobe Dreamweaver

Avatar of undefined
Last Comment
Jason C. Levine
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Hi Jesse26,

We may need to see the rest of the ASP code to troubleshoot it, but I see problems with the above.

<a href="The_Empire_Store_Gear.asp"<img src="<%=(Recordset1.Fields.Item("Picture").Value)%>"></a>

The img command is embedded into the <a> tag instead of being enclosed by it.  Should be:

<a href="The_Empire_Store_Gear.asp"><img src="<%=(Recordset1.Fields.Item("Picture").Value)%></a>

Now, that should link the image to The_Empire_Store_Gear.asp page.  If you want that page to do a lookup, you will need to feed it a variable.  Without seeing the structure of the table, I don't know which variable to feed it...
Avatar of Jesse26
Jesse26

ASKER

What can i give you to aid in the lookup?  I am not really sure what type of variable to use.  I want to show all the records in this table.  When I replaced the code the page blew up.
Post the page code, including the ASP...
Avatar of Jesse26
Jesse26

ASKER

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Empire.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_Empire_STRING
Recordset1.Source = "SELECT * FROM Store ORDER BY CatagoryID ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Empire Volleyball Club</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
body {
      background-color: #000000;
}
.style3 {font-family: "Copperplate Gothic Bold"}
.style5 {font-family: "Copperplate Gothic Bold"; font-size: 14px; }
-->
</style></head>

<body>
<table width="850" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr bgcolor="#FFFFFF">
    <td width="234" height="210"><img src="Top/EmpireShadow250x250.gif" width="234" height="206" hspace="0" vspace="0"> </td>
    <td colspan="4"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="725" height="210">
      <param name="movie" value="Top/Empirevolleyball.swf">
      <param name=quality value=high><param name="BGCOLOR" value="#FFFFFF">
      <embed src="Top/Empirevolleyball.swf" width="725" height="210" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#FFFFFF"></embed>
    </object></td>
  </tr>
</table>
<table width="944" height="582" border="0" cellpadding="0" cellspacing="0">
  <tr bgcolor="#000000">
    <td height="38" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="38">&nbsp;</td>
    <td colspan="3">&nbsp;</td>
    <td width="9" rowspan="9">&nbsp;</td>
    <td width="13" rowspan="9">&nbsp;</td>
  </tr>
  <tr bgcolor="#000000">
    <td height="28" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="28">&nbsp;</td>
    <td height="28" colspan="3">&nbsp;</td>
  </tr>
<tr bgcolor="#000000">
    <td height="0" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="29">&nbsp;</td>
    <td width="223" height="29" bgcolor="#FFFFFF"><span class="style3"><%=(Recordset1.Fields.Item("ProdName").Value)%></span></td>
    <td width="265" bgcolor="#FFFFFF"><span class="style5">Click Any Picture for more info </span></td>
    <td width="182" bgcolor="#FFFFFF"><div align="center"><span class="style3"><%=(Recordset1.Fields.Item("Price").Value)%></span></div></td>
  </tr>
  <tr bgcolor="#000000">
    <td height="19" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="19">&nbsp;</td>
    <td height="19" colspan="3" bgcolor="#FFFFFF"><div align="center"> <a href="The_Empire_Store_Gear.asp"><img src="<%=(Recordset1.Fields.Item("Picture").Value)%></a>


  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>

  <tr bgcolor="#000000">
    <td height="19" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="19">&nbsp;</td>
    <td height="19" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="19" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="19" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
<tr bgcolor="#000000">
    <td height="41" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="41">&nbsp;</td>
    <td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
  <tr bgcolor="#000000">
    <td height="82" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="82">&nbsp;</td>
    <td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
  <tr bgcolor="#000000">
    <td width="233" height="63" bgcolor="#FFFFFF"><table width="233" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table></td>
    <td width="19" bgcolor="#000000">&nbsp;</td>
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr bgcolor="#000000">
    <td height="19" colspan="5" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
</table>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="517" height="274" style="position: absolute; top:  271px; left: 10px; z-index:1; visibility: hidden;" >
  <param name="movie" value="Menu/empireleft_nav.swf" />
  <param name="quality" value="high" />
  <param name="allowScriptAccess" value="always" />
  <param name="wmode" value="transparent" />
  <embed src="Menu/empireleft_nav.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="517" height="274" allowScriptAccess="always" wmode="transparent"></embed>
</object>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Hi Jesse.

Possible mea culpa coming.  The code I posted is not correct (hangs head in shame):

<a href="The_Empire_Store_Gear.asp"><img src="<%=(Recordset1.Fields.Item("Picture").Value)%></a>

is missing some closing quotes.  Try:

<a href="The_Empire_Store_Gear.asp"><img src="<%=(Recordset1.Fields.Item("Picture").Value)%>" ></a>

Also make sure the value stored in the field "Picture" points to the correct path and file name to the image.
Avatar of Jesse26
Jesse26

ASKER

That worked- sweet
while I have you here what if i had multiple pictures being accessed via repeating recordsets
In other words i have a few pictures being accessed and now I want to have each one go to a different url.  I uped the points!
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Adobe Dreamweaver
Adobe Dreamweaver

Adobe Dreamweaver is a web development tool featuring both WYSIWYG and code editors that allow the user to quickly and easily build websites in a wide variety of languages, including ASP, ASP.NET, ColdFusion and PHP. It also offers support for CSS and JavaScript.

11K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo