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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting unique id of next record

Status
Not open for further replies.

s4dadmin

Programmer
Apr 27, 2003
107
0
0
US
I have a script where I use recordset paging and it works fine. There are previous and next links to navigate. I currently only have one record showing at a time. It is a photo gallery. I want to be able to get the id of the next and previous unique id while i am viewing the current photo so I can calculate hits. Can anyone help? Here is some code

Code:
sql2 = "Select tbl_Images.* From tbl_Images Where imageEventID="&tid&";"
Set rsGallery = Server.CreateObject("ADODB.Recordset")
rsGallery.PageSize = 1
rsGallery.CacheSize = 5
rsGallery.CursorLocation = adUseClient
rsGallery.Open sql2, adoCon, adOpenForwardOnly, adLockReadOnly

If abspage = 1 Then
	Response.Write "|< First"
	Response.Write "	|	"
	
Else
Response.Write "<a href="""
Response.Write Request.ServerVariables("SCRIPT_NAME")
Response.Write "?tid="&tid&"&pagenum=1"">|&lt; First</a>"
Response.Write "	|	"

End IF
If abspage = 1 Then
	Response.Write "&lt;&lt; Previous"
Else
	Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME")
	Response.Write "?tid="&tid&"&pagenum=" & abspage - 1 & """>&lt;&lt; Previous</a>"
End If

Response.Write "	|	"
	If abspage < pagecnt Then
		Response.Write "<a href=""" & _
			Request.ServerVariables("SCRIPT_NAME")
		Response.Write "?tid="&tid&"&pagenum=" & abspage + 1 & """>&gt;&gt; Next</a>"
	Else
		Response.Write "&gt;&gt; Next"
End If

Response.Write "	|	"
If abspage < pagecnt Then
Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME")
	Response.Write "?tid="&tid&"&pagenum=" & pagecnt & """>&gt;| Last</a>"
	Else
		Response.Write "&gt;| Last"
End If	
Response.Write "</div>" & vbcrlf

Else
	Response.Write "No records found!"
End If

Quincy
 
what do u mean by hits???

Known is handfull, Unknown is worldfull
 
By hits I mean counting the number of times the image has been viewed. Just like you would pass your mouse over the next link it would show the next page number I want to show the next image id along with the page number because I am only showing 1 record per page.

Quincy
 
can u highlight the code that will create image link???

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top