Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2012-08-20
4
Medium Priority
?
710 Views
Last Modified: 2012-08-20
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...
0
Comment
Question by:Stiebel Eltron
  • 2
  • 2
4 Comments
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 38310922
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
 

Author Comment

by:Stiebel Eltron
ID: 38311035
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
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 38311049
<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
 

Author Closing Comment

by:Stiebel Eltron
ID: 38314713
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

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
By following these Magento e-commerce development tips, you can increase your website's conversion and profitability. Read this post for more details.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question