Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - help on how to display 10 results per pag
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

help on how to display 10 results per pag

 Post Reply Post Reply
Author
amisima View Drop Down
Newbie
Newbie


Joined: 09 June 2003
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote amisima Quote  Post ReplyReply Direct Link To This Post Topic: help on how to display 10 results per pag
    Posted: 16 June 2003 at 10:52am
Hi,
I have a search page using asp and I would like to know if anyone knows how to display 10 results per page with navigation for the remaning pages.

Thanks,
Amisima
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 11:04am

try to make a database to this ex. then U will see how it works

filname.asp
<%
intPage = Request("Site")
If isNumeric(intPage) = False Or intPage < 1 Then
   intPage = 1
End If

Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * from SITE ORDER BY id DESC"
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("db.mdb")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
    rs.PageSize = 5
    rs.AbsolutePage = intPage
    intRecCount = rs.PageSize
    intPageCount = rs.PageCount
    Response.Write "<div><b>Site " & intPage & " Of " & intPageCount & "</b></div>"
    Do While Not rs.EOF And intRecCount > 0
%>
<table border="0" width="100%">
  <tr>
    <td width="50%"><% =rs("Name") %></td>
    <td width="50%"><% =rs("Age") %> Years</td>
  </tr>
</table>
<%
    intRecCount = intRecCount - 1
    rs.MoveNext
    Loop
End If
rs.Close
Set rs = Nothing

Response.Write "<p class=""mainbody"">Go to Site "
For intNum = 1 To intPageCount
    Response.Write "<b><a href=filname.asp?Site=" & intNum & ">" & intNum & "</a></b> "
Next

Response.Write "<p>"
If Clng(intPage) > 1 Then
    Response.Write "<a href=filname.asp?Site=" & intPage - 1 & "><b>&#8592; Back</b></a> "
Else
    Response.Write ""
End If

Response.Write "&nbsp;"
If Clng(intPage) < Clng(intPageCount) Then
    Response.Write "<a href=filname.asp?Site=" & intPage + 1 & "><b>Next &#8594;</b></a> "
Else
    Response.Write ""
End If
%>

Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 11:05am

If u want it to show 10 results per site then changes this line

rs.PageSize = 5

to this

rs.PageSize = 10

Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 11:08am

The database

db.mdb
SITE

id = Au. and Pri. key
name = Text
age = Number

save it and make som names in it !!!!

 

then U are running !!!!

Back to Top
amisima View Drop Down
Newbie
Newbie


Joined: 09 June 2003
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote amisima Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 11:49am
Thanks for the help I will try that
AMisima
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 11:50am
NP
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.