Forums
This topic is locked
IDs and Detail Pages
Posted 23 Oct 2001 12:18:12
1
has voted
23 Oct 2001 12:18:12 david bloomfield posted:
hello, please help meI am creating an admin section for a site.
I have created a page which displays a list of records that links to update and delete pages.
My problem is that even though the correct ID is displayed for each record in the URL, the first record from the database is always displayed, instead of the record with the corresponding id, which has been passed through the URL.
I have created pages like this successfully before and i have compared the code and can find no difference. Below is the code for the page that doesnt work.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/healthsoap.asp" -->
<%
set rsAdmin = Server.CreateObject("ADODB.Recordset"
rsAdmin.ActiveConnection = MM_healthsoap_STRING
rsAdmin.Source = "SELECT * FROM customer_tests"
rsAdmin.CursorType = 0
rsAdmin.CursorLocation = 2
rsAdmin.LockType = 3
rsAdmin.Open()
rsAdmin_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsAdmin_numRows = rsAdmin_numRows + Repeat1__numRows
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "" Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "" Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "" Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="healthsoap.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="400" border="0" class="tableborder" cellspacing="0" cellpadding="4">
<tr>
<td class="btext" colspan="3">
ADMIN PAGE FOR TESTIMONIALS
</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsAdmin.EOF))
%>
<tr bgcolor="<%
If (Repeat1__numRows Mod 2) Then
Response.Write("#FFFFFF"
Else
Response.Write("#efefef"
End IF
%>" >
<td width="132" class="text"><%=(rsAdmin.Fields.Item("customer_name".Value)%></td>
<td width="125" class="text"><A HREF="update_testimonial.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "customer_id=" & rsAdmin.Fields.Item("customer_id".Value %>">Update</A></td>
<td width="121" class="text"><A HREF="delete_testimonial.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "customer_id=" & rsAdmin.Fields.Item("customer_id".Value %>">Delete</A></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsAdmin.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
rsAdmin.Close()
%>
I would be grateful for any response. thanks for your time.
David
Replies
Replied 23 Oct 2001 16:03:23
23 Oct 2001 16:03:23 simon bloodworth replied:
Hi
On the detail page have you placed the 'move to specific record' behaviour.
do this and set it to match the ID ref being passed from the previous page.
Hope that helps.
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hello, please help me
I am creating an admin section for a site.
I have created a page which displays a list of records that links to update and delete pages.
My problem is that even though the correct ID is displayed for each record in the URL, the first record from the database is always displayed, instead of the record with the corresponding id, which has been passed through the URL.
I have created pages like this successfully before and i have compared the code and can find no difference. Below is the code for the page that doesnt work.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/healthsoap.asp" -->
<%
set rsAdmin = Server.CreateObject("ADODB.Recordset"
rsAdmin.ActiveConnection = MM_healthsoap_STRING
rsAdmin.Source = "SELECT * FROM customer_tests"
rsAdmin.CursorType = 0
rsAdmin.CursorLocation = 2
rsAdmin.LockType = 3
rsAdmin.Open()
rsAdmin_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsAdmin_numRows = rsAdmin_numRows + Repeat1__numRows
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "" Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "" Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "" Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="healthsoap.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="400" border="0" class="tableborder" cellspacing="0" cellpadding="4">
<tr>
<td class="btext" colspan="3">
ADMIN PAGE FOR TESTIMONIALS
</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsAdmin.EOF))
%>
<tr bgcolor="<%
If (Repeat1__numRows Mod 2) Then
Response.Write("#FFFFFF"
Else
Response.Write("#efefef"
End IF
%>" >
<td width="132" class="text"><%=(rsAdmin.Fields.Item("customer_name".Value)%></td>
<td width="125" class="text"><A HREF="update_testimonial.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "customer_id=" & rsAdmin.Fields.Item("customer_id".Value %>">Update</A></td>
<td width="121" class="text"><A HREF="delete_testimonial.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "customer_id=" & rsAdmin.Fields.Item("customer_id".Value %>">Delete</A></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsAdmin.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
rsAdmin.Close()
%>
I would be grateful for any response. thanks for your time.
David
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Simon
On the detail page have you placed the 'move to specific record' behaviour.
do this and set it to match the ID ref being passed from the previous page.
Hope that helps.
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hello, please help me
I am creating an admin section for a site.
I have created a page which displays a list of records that links to update and delete pages.
My problem is that even though the correct ID is displayed for each record in the URL, the first record from the database is always displayed, instead of the record with the corresponding id, which has been passed through the URL.
I have created pages like this successfully before and i have compared the code and can find no difference. Below is the code for the page that doesnt work.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/healthsoap.asp" -->
<%
set rsAdmin = Server.CreateObject("ADODB.Recordset"
rsAdmin.ActiveConnection = MM_healthsoap_STRING
rsAdmin.Source = "SELECT * FROM customer_tests"
rsAdmin.CursorType = 0
rsAdmin.CursorLocation = 2
rsAdmin.LockType = 3
rsAdmin.Open()
rsAdmin_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
rsAdmin_numRows = rsAdmin_numRows + Repeat1__numRows
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "" Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "" Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "" Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="healthsoap.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="400" border="0" class="tableborder" cellspacing="0" cellpadding="4">
<tr>
<td class="btext" colspan="3">
ADMIN PAGE FOR TESTIMONIALS
</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsAdmin.EOF))
%>
<tr bgcolor="<%
If (Repeat1__numRows Mod 2) Then
Response.Write("#FFFFFF"
Else
Response.Write("#efefef"
End IF
%>" >
<td width="132" class="text"><%=(rsAdmin.Fields.Item("customer_name".Value)%></td>
<td width="125" class="text"><A HREF="update_testimonial.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "customer_id=" & rsAdmin.Fields.Item("customer_id".Value %>">Update</A></td>
<td width="121" class="text"><A HREF="delete_testimonial.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "customer_id=" & rsAdmin.Fields.Item("customer_id".Value %>">Delete</A></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsAdmin.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
rsAdmin.Close()
%>
I would be grateful for any response. thanks for your time.
David
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Simon