Forums
This topic is locked
Link Views Not Working.
Posted 25 Sep 2008 08:07:39
1
has voted
25 Sep 2008 08:07:39 Ishfaak Aha posted:
www.bynd.net/view-addeddw/clickview.asp In detaild I have added this, please Help me.In the clickview.asp the link values are not adding having the ID as the Primary Key. When clik on the Link caled by the URL, ir redirects to the redirect.asp ( <a href="redirect.asp?ID=<%=(rsClicks.Fields.Item("URL".Value)%>" target="_blank"> ) and goes to the link that works but it dosent add the value ( objConn.Execute "UPDATE SiteClicks SET ClickCount = ClickCount + 1 WHERE URL='" & SiteURL & "'"
) to the clickcount field in the redirect.asp in the DB. Please help to get this link Views error sorted.
clickview.asp code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim MM_connClicks_STRING
MM_connClicks_STRING = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("clickcounts.mdb")
%>
<%
Dim rsClicks
Dim rsClicks_numRows
Set rsClicks = Server.CreateObject("ADODB.Recordset"
rsClicks.ActiveConnection = MM_connClicks_STRING
rsClicks.Source = "SELECT * FROM SiteClicks"
rsClicks.CursorType = 0
rsClicks.CursorLocation = 2
rsClicks.LockType = 1
rsClicks.Open()
rsClicks_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsClicks_numRows = rsClicks_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsClicks_total
Dim rsClicks_first
Dim rsClicks_last
'set the record count
rsClicks_total = rsClicks.RecordCount
' set the number of rows displayed on this page
If (rsClicks_numRows < 0) Then
rsClicks_numRows = rsClicks_total
Elseif (rsClicks_numRows = 0) Then
rsClicks_numRows = 1
End If
' set the first and last displayed record
rsClicks_first = 1
rsClicks_last = rsClicks_first + rsClicks_numRows - 1
' if we have the correct record count, check the other stats
If (rsClicks_total <> -1) Then
If (rsClicks_first > rsClicks_total) Then
rsClicks_first = rsClicks_total
End If
If (rsClicks_last > rsClicks_total) Then
rsClicks_last = rsClicks_total
End If
If (rsClicks_numRows > rsClicks_total) Then
rsClicks_numRows = rsClicks_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (rsClicks_total = -1) Then
' count the total records by iterating through the recordset
rsClicks_total=0
While (Not rsClicks.EOF)
rsClicks_total = rsClicks_total + 1
rsClicks.MoveNext
Wend
' reset the cursor to the beginning
If (rsClicks.CursorType > 0) Then
rsClicks.MoveFirst
Else
rsClicks.Requery
End If
' set the number of rows displayed on this page
If (rsClicks_numRows < 0 Or rsClicks_numRows > rsClicks_total) Then
rsClicks_numRows = rsClicks_total
End If
'set the first and last displayed record
rsClicks_first = 1
rsClicks_last = rsClicks_first + rsClicks_numRows - 1
If (rsClicks_first > rsClicks_total) Then
rsClicks_first = rsClicks_total
End If
If (rsClicks_last > rsClicks_total) Then
rsClicks_last = rsClicks_total
End If
End If
%>
<html>
<head>
<title>Clickthroughs</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function mark(face,field_color,text_color){
if (document.documentElement){//if browser is IE5+ or NS6+
face.style.backgroundColor=field_color;
face.style.color=text_color;
}
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function PopdbDes(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=425,height=438,left = 330,top = 213');"
}
// End -->
</script>
</head>
<body>
<div align="center"><strong><font size="4" face="Tahoma"> Website Click through for edit</font></strong></div>
<div align="center"><br>
<table width="65%" border="0">
<tr>
<td> <div align="right"><font size="1" face="Tahoma">
Showing a total of : <%=(rsClicks_total)%> links </font></div></td>
</tr>
</table>
<table width="65%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr>
<td>
<table width="699" border="0" cellspacing="1">
<tr bgcolor="#3399CC">
<td width="21%"> <font color="#FFFFFF">Name</font></td>
<td width="15%"> <font color="#FFFFFF">Position</font></td>
<td width="11%"> <font color="#FFFFFF">Salary</font></td>
<td width="14%" align="center">
<font face="Times New Roman">URL</font></td>
<td width="8%">
<b>
<font face="Arial" size="2" color="#FFFFFF">Age</font></b></td>
<td width="25%"> <div align="center"><font color="#FFFFFF" size="2" face="Tahoma">
<strong>Click through for Description</strong></font></div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsClicks.EOF))
%>
<tr bgcolor="#FFFFFF" onMouseOver="mark(this,''#FFFF99'',''#000000'')"
onMouseOut="mark(this,''#FFFFFF'',''#000000'')">
<td width="21%"><font size="1" face="Arial"><%=(rsClicks.Fields.Item("DBName".Value)%></font></td>
<td width="15%"><font size="1" face="Arial"><%=(rsClicks.Fields.Item("DBposition".Value)%></font></td>
<td width="11%"><font size="1" face="Arial"><%=(rsClicks.Fields.Item("DBsalary".Value)%></font></td>
<td width="14%" align="center">
<!-- heres the place where based on ID it calls the URL -->
<a href="redirect.asp?ID=<%=(rsClicks.Fields.Item("URL".Value)%>" target="_blank">
<!-- heres the place where based on ID it calls the URL -->
<font face="Arial" size="1"><%=(rsClicks.Fields.Item("URL".Value)%></font></a></td>
<td width="8%"><font size="1" face="Arial"><%=(rsClicks.Fields.Item("DBage".Value)%></font></td>
<td width="25%">
<p align="center"><font face="Arial" size="1"><span style="font-size: 8.0pt; font-family: Arial">More</span></a>
<b><font color="#FF6600">(</font></b>views:<%=(rsClicks.Fields.Item("ClickCount".Value)%><b><font color="#FF6600"><img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle></font></b></span></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsClicks.MoveNext()
Wend
%>
</table></td>
</tr>
</table>
<br>
<br>
</div>
<table border="1" width="100%" cellspacing="5\" id="table1" cellpadding="5" bgcolor="#000000">
<tr>
<td width="331">
<img border="0" src="images/001.jpg" width="331" height="334"></td>
<td>
<p align="center">
<img border="0" src="images/002.jpg" width="499" height="512"></td>
</tr>
<tr>
<td colspan="2">
<br>
<img border="0" src="images/003.jpg" width="924" height="221"></td>
</tr>
</table>
</body>
</html>
<%
rsClicks.Close()
Set rsClicks = Nothing
%>
-------------------------------------
redirect.asp code:
<%
'SiteURL = Request.QueryString("URL"
SiteURL = Request.QueryString("ID"
If Len(SiteURL) > 0 Then
Set objConn = CreateObject("ADODB.Connection"
objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/view-addeddw/clickcounts.mdb" & ";Persist Security Info=False"
' If the URL is already in the database an error will be thrown and we perform an UPDATE Instead of a INSERT.
on error resume next
'objConn.Execute "INSERT INTO SiteClicks(URL,ClickCount) VALUES('" & SiteURL & "',1)"
If Err.Number <> 0 Then
objConn.Execute "UPDATE SiteClicks SET ClickCount = ClickCount + 1 WHERE URL='" & SiteURL & "'"
'objConn.Execute "UPDATE SiteClicks SET ClickCount = ClickCount + 1 WHERE URL='" & SiteURL & "'"
'rs.Execute("UPDATE salinfo SET ClickCount = ClickCount + 1 WHERE ID=" & rs("ID")
End If
objConn.Close
Set objConn= Nothing
Response.redirect SiteURL
End If
%>
www.bynd.net/view-addeddw/clickview.asp In detaild I have added this, please Help me.
Thank you.
I.A
Hello