How to add the LINK of the search result using ASP?

Dear EE experts,

We would like to ask for tech support on how to add the link of the search results items.
If we search, the results would have its ID, SERIES NAME, and the LINK.
Please see the attached embed script for reference:
<%
Dim myConnection, rsProducts
Dim connectString
Dim sqlContent
Dim requestSeries

connectString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=SERVER PORT=PORT; DATABASE=DBASE; USER=DBUSER; PASSWORD=DBPW; OPTION=0;"

Set myConnection = Server.CreateObject("ADODB.Connection")
Set rsProducts = Server.CreateObject("ADODB.Recordset")

'SeriesID = Request.QueryString("SeriesID")
myConnection.Open connectString

requestSeries = Request.Form("Series")

	sqlContent = "Select * From series WHERE series_name LIKE '%" & requestSeries &"%'"
	
	Set rsProducts = myConnection.Execute(sqlContent)
	
	If (rsProducts.BOF) AND (rsProducts.EOF) then
		Response.Write("Sorry, but Product Series " & requestSeries & " was not found.")
		
	Else	
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
----------
</head>

<body bgproperties="fixed" bgcolor="#000000" onload="javascript:startmenu()">
<table width="760" border="0" cellspacing="3" cellpadding="1">
  <tr>
    <td><img src="IMG/logo_res.jpg" alt="STIEBEL ELTRON" /></td>
    <td valign="top" bgcolor="#666666">
    	<SCRIPT LANGUAGE="JavaScript">
    	<!-- Begin
		showImage();
		//  End -->
		</script>
    </td>
    <td><img src="IMG/white_square.png" alt="STIEBEL ELTRON" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right" bgcolor="#999999"><font face="Verdana, Geneva, sans-serif" color="#FFFFFF">
    <%
   '// If user is logged in show name and logout link
   If Session("loggedin") = true Then
      Response.Write "Welcome: " & Session("FName")
      Response.Write "<br /><a href=""login/logout.asp"">Logout</a>"
   Else
      Response.Write "<a href=""ste-iphoto-login2.asp"" title=""CLICK TO LOGIN"">REGISTERED USERS</a>"
   End If
	%>&nbsp;
	</td>
    <td bgcolor="#666666" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    
    <td align="left" bordercolor="#999999" bgcolor="#FFFFFF">
    	Search Request Result from the keyword: <% Response.Write("" & requestSeries & "") %>
	</td>
	<td bgcolor="#999999" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    
	<td align="left" bordercolor="#999999" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="3" cellpadding="1">
	<tr>
    	<td bgcolor="#999999" align="center">
        ID
        </td>
    	<td bgcolor="#999999" align="center">
        SERIES NAME
        </td>
    	<td bgcolor="#999999" align="center">
        LINK
        </td>
	</tr>
    
    <!-- Get Data -->
    <% do while not rsProducts.EOF %>
    
    <tr>
    	<td align="center" class="td2" bgcolor="#CCCCCC">
        	<%=rsProducts("categoryid")%>
        </td>
    	<td class="td2" bgcolor="#CCCCCC">
        	<%=rsProducts("series_name")%>
        </td>
    	<td class="td2" bgcolor="#CCCCCC">
        	&nbsp;
        </td>
    </tr>
    <% rsProducts.MoveNext %>
    <% loop %><!--Next Row-->

</table>

Open in new window


We would like to put the link on the "&nbsp;" inside the column of the LINK.

Thank you in advance and hope to hear soon...
Stiebel EltronAsked:
Who is Participating?
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
<td class="td2" bgcolor="#CCCCCC">
              <a href="somepage.asp?id=<%=rs("Link")%>"><%=rs("ID")&" "&rs("SERIES_NAME")%></a>
        </td>

or just

  <td class="td2" bgcolor="#CCCCCC">
              <a href="somepage.asp"><%=rs("ID")&" "&rs("SERIES_NAME")%></a>
   </td>

if no page

  <td class="td2" bgcolor="#CCCCCC">
              <a href="#"><%=rs("ID")&" "&rs("SERIES_NAME")%></a>
   </td>

Just keep going back to a regular html link looks like <a href="url.asp">link</a> or if no actual page <a href="#">link</a>
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Since a link looks like <a href="url.asp">link</a> your code will look like below. I did not check your exact recordset names so please make sure you adjust as  needed.

      <td class="td2" bgcolor="#CCCCCC">
              <a href="<%=rs("Link")%>"><%=rs("ID")&" "&rs("SERIES_NAME")%></a>
        </td>
0
 
Stiebel EltronAuthor Commented:
Hi there Padas!

That's what we're thinking, but how if we don't have "Link" from the db?
Is there any other way to have the link of the result?
0
 
Stiebel EltronAuthor Commented:
Though the solution isn't 100% exactly what we need, but we got idea on how to resolve this problem...

Thank you! Hope to hear from you again, padas, on our next thread...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.