Page = Request.QueryString("pg")
If Page="" then
Page = 1
Else
Page = CInt(Page)
End if
Set conn = server.CreateObject("ADODB.Connection")
Set rs = server.CreateObject("ADODB.RecordSet")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("urdatabase.mdb")
conn.CursorLocation = 3
if rs.recordcount = 0 then
response.write "Record Doesn't Found"
else
Rs.PageSize = 8 'Indicates Records Per Page
Rs.AbsolutePage = Page 'Indicates The Page to Display
response.write "<tr><td colspan=2> You Search For <b>" & phone & "</b>. And We Found <b>" & rs.recordcount & "</b> results.</td></tr>"
response.write "<tr><td height=5> </td></tr>"
while (not rs.EOF And Rs.AbsolutePage = Page)
response.write "<tr><td> Name </td><td>" & StrCH(rs.fields(1)) & "</td></tr>"
response.write "<tr><td> Address </td><td>" & rs.fields(2) & "</td></tr>"
'-----------Function to bold the text-----------
Function StrCh(a)
StrCh = Replace(a,phone,"<b>" & phone & "</b>")
End Function
'----------Table to Write Down the Pages-------------
'Rs.PageCount returns the number of pages.............
response.write "<table><td><center>Pages>> "
For i = 1 to Rs.PageCount
If i = Page then
Response.Write "<font color=black>" & i & "</font>"
Else
Response.Write " <a href=phone_search.asp?pg="&i&"&query=" & sap & "&mysearch=" & phone & ">" & i & "</a> "
End If
Next
end if
%>
</table>