I've created a keyword search which displays a list of names as hyperlinks - clicking a name takes the user to a second page with details about that name e.g. phone number, email, fax etc. It's paginated also - showing 10 records at a time.
The error shows the following part of my code as the problem
Response.write "<a href= "searchresult2.asp?ID=<% =objRS("ID")%>" >" <% =objRS("FamilyName") %> "</a>"
Very grateful if anyone can spot a problem with this as i've spent two days and got nowhere! Many thanks for your time...
FULL CODE
<%
DIM mySQL,objRS,detail
detail=Request.querystring("nameinput")
detail=Trim(Request("detail"))
mySQL="SELECT ID, FamilyName, DeptName, Department, PostTitle, PersonalTelephoneNumber, OtherPhone" & _
"FROM table " & _
"WHERE FamilyName LIKE '%" & Request.querystring("nameinput") & "%' OR DeptName LIKE '%" & Request.querystring("nameinput") & "%' OR Department LIKE '%" & Request.querystring("nameinput") & "%'"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=path\DB.mdb"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorType = 1
objRS.Open mySQL, objConn
DIM intPageRecords, intRecords, intRecordCount, intCurrentPage
DIM intNumberOfPages, intDisplayPage
intPageRecords = Request.Querystring("page")
IF intPageRecords = "" THEN intPageRecords = 1 : intRecords = 1
intRecords = intPageRecords
intPageRecords = ((intPageRecords - 1) * 10) +1
intRecordCount = 0
if objRS.recordcount = 0 then
response.redirect("noresults.asp")
end if
if Not objRS.Eof then
objRS.Move (intPageRecords - 1)
Response.Write ("<hr width='90%' align='left'>")
DO WHILE intRecordCount < 10 and NOT objRS.EOF
Response.write "<a href= "searchresult2.asp?ID=<% =objRS("ID")%>" >" <% =objRS("FamilyName") %> "</a>"
Response.write "<br>"
objRS.movenext
intRecordCount = intRecordCount +1
Loop
END IF
Response.Write ("<hr width='90%' align='left'>")
%>
<%=intPageRecords%> - <%=intPageRecords+(intRecordCount-1)%> of <%=(objRS.RecordCount)%> entries
<p>Entries
<%
intCurrentPage = Request.Querystring("page")
IF intCurrentPage = "" THEN intCurrentPage = 1
intNumberOfPages = int(objRS.RecordCount \ 10)
IF objRS.RecordCount MOD 10<> 0 THEN intNumberOfPages = intNumberOfPages + 1
Response.Write("Pages: [")
FOR intDisplayPage = 1 TO intNumberOfPages
IF Cint(intDisplayPage) = Cint(intCurrentPage) THEN
Response.Write " <b>" & intDisplayPage & "</b> "
ELSE
Response.Write " <a href=""searchresultb.asp?nameinput="&Request.querystring("nameinput")& "&page=" & intDisplayPage & """>" & intDisplayPage &_
"</a> "
END IF
NEXT
Response.Write ("]")
Response.write "<br>"
Response.write "<br>"
Response.write "<a href=NAME.asp>" & "Back to Search Page" & "</a>"
%>
The error shows the following part of my code as the problem
Response.write "<a href= "searchresult2.asp?ID=<% =objRS("ID")%>" >" <% =objRS("FamilyName") %> "</a>"
Very grateful if anyone can spot a problem with this as i've spent two days and got nowhere! Many thanks for your time...
FULL CODE
<%
DIM mySQL,objRS,detail
detail=Request.querystring("nameinput")
detail=Trim(Request("detail"))
mySQL="SELECT ID, FamilyName, DeptName, Department, PostTitle, PersonalTelephoneNumber, OtherPhone" & _
"FROM table " & _
"WHERE FamilyName LIKE '%" & Request.querystring("nameinput") & "%' OR DeptName LIKE '%" & Request.querystring("nameinput") & "%' OR Department LIKE '%" & Request.querystring("nameinput") & "%'"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=path\DB.mdb"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorType = 1
objRS.Open mySQL, objConn
DIM intPageRecords, intRecords, intRecordCount, intCurrentPage
DIM intNumberOfPages, intDisplayPage
intPageRecords = Request.Querystring("page")
IF intPageRecords = "" THEN intPageRecords = 1 : intRecords = 1
intRecords = intPageRecords
intPageRecords = ((intPageRecords - 1) * 10) +1
intRecordCount = 0
if objRS.recordcount = 0 then
response.redirect("noresults.asp")
end if
if Not objRS.Eof then
objRS.Move (intPageRecords - 1)
Response.Write ("<hr width='90%' align='left'>")
DO WHILE intRecordCount < 10 and NOT objRS.EOF
Response.write "<a href= "searchresult2.asp?ID=<% =objRS("ID")%>" >" <% =objRS("FamilyName") %> "</a>"
Response.write "<br>"
objRS.movenext
intRecordCount = intRecordCount +1
Loop
END IF
Response.Write ("<hr width='90%' align='left'>")
%>
<%=intPageRecords%> - <%=intPageRecords+(intRecordCount-1)%> of <%=(objRS.RecordCount)%> entries
<p>Entries
<%
intCurrentPage = Request.Querystring("page")
IF intCurrentPage = "" THEN intCurrentPage = 1
intNumberOfPages = int(objRS.RecordCount \ 10)
IF objRS.RecordCount MOD 10<> 0 THEN intNumberOfPages = intNumberOfPages + 1
Response.Write("Pages: [")
FOR intDisplayPage = 1 TO intNumberOfPages
IF Cint(intDisplayPage) = Cint(intCurrentPage) THEN
Response.Write " <b>" & intDisplayPage & "</b> "
ELSE
Response.Write " <a href=""searchresultb.asp?nameinput="&Request.querystring("nameinput")& "&page=" & intDisplayPage & """>" & intDisplayPage &_
"</a> "
END IF
NEXT
Response.Write ("]")
Response.write "<br>"
Response.write "<br>"
Response.write "<a href=NAME.asp>" & "Back to Search Page" & "</a>"
%>