Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - how can i skip to the next user?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how can i skip to the next user?

 Post Reply Post Reply Page  123>
Author
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Topic: how can i skip to the next user?
    Posted: 11 April 2003 at 3:10am

does anyone know the best way i can put a "next" button on a page - to show the next set of details - but not by ID but by the last name

so ya can skip to the next person alphabetaicly?

 

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 11 April 2003 at 2:54pm

When you open the recordset use the SQL statement

SELECT * FROM yourfield
FROM yourtable
ORDER BY yourfield asc

not totally positive on my coding but you should get the basic idea... this will order 'yourfield' from 'yourtable' into ascending alphabetical order. now you can use the following HTML statement to move to the next name in the list.

<a href="<%rs.movenext%>">Next name</a>

now, this tells the computer to move to the next record and since they're ordered in alphabetical it moves to the next record. This link needs to be on the same page as the opening calls for the database and sql statement. Something like this

'open your database
'recordset opening call
'html beginning
'your link
'html ending

hope i helped...

Paul Morgan
Webmaster

 

 

Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2003 at 4:55am

hi - thanks

umm could ya explain that a lil better cose i dont quite get it

i tryed sum things but with out success

do i put "SELECT * FROM table WHERE field = string ORDER BY lastname" ???

or not

 could i please have sum example code?

(thanks for the help)

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2003 at 8:50am

no problem- the only problem with using a "WHERE" clause is that it only selects what it equals. For example: If you have several records, lastnames (to make it easy) 5, 4, 3, 2, and 1, and you use the line "SELECT * FROM yourtable WHERE lastname = 5" then it will only select 5. My suggestion, drop the where clause and only use select and order by. Try this,

"SELECT * FROM yourtable ORDER BY lastname"

then use the link i posted before to move to the next record.

Paul Morgan

 

Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2003 at 8:51am
oh, well how will i know which is the next record then?
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2003 at 8:53am
because there ordered in alphabetical order according to their lastnames. Try it and see if it works.
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2003 at 8:54am

yeah but i mean, say am on record number 5 how will i know i wanna go to number 6? cose it wont know am on record 5? will it?

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2003 at 9:01am

when you select the fields and use a where clause it only selects what you specify in the where clause . for example: you have a table: with one field called 'I' (remember i'm making it simple) the values of i are 1, 2, 3, 4, 5, 6, 7, and 8. if you only select 5 then the computer doesn't worry about 1, 2, 3, 4, 6, 7, and 8. When open up a recordset your basically telling the computer with a WHERE clause that you only need 5. When you say 'rs.movenext' then you hit EOF and you get a falure. If it was imperitive that you start on 5 then you would say:

"SELECT * FROM yourtable"
rs.movefirst
loop = 5
While loop > 0
rs.movenext
Wend

this would take your record pointer and place it on the fifth one in order.



Edited by pmormr
Back to Top
 Post Reply Post Reply Page  123>

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.