Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

davaddavad
Joined: Aug 02, 2001
# Posts: 928

View the profile for davaddavad Send davaddavad a private message

Posted: 2003-May-20 21:12
Edit Message Delete Message Reply to this message

Does anyone have a php next previous button tutorial they are willing to post?



NEntropy
Joined: Dec 08, 1999
# Posts: 1117

View the profile for NEntropy Send NEntropy a private message

Posted: 2003-May-20 23:17
Edit Message Delete Message Reply to this message

Are you using mySQL as the database? I'm assuming that you are, and that you mean next previous button in a long list of items. Otherwise, ignore this. smile

If you are using mySQL, then you can do a "LIMIT" clause on your SQL statement to limit the number of items being returned. So, if you do SELECT * FROM db LIMIT 20, 10 it'll return 21st record to the 30th record.

Using this, you can easily implement a next/previous button by passing an offset variable. Assume it to be 0 if not set (or not integer), and use it as the offset (20 in the case above) if the value being returned in valid.



langard
Joined: Dec 15, 1999
# Posts: 339

View the profile for langard Send langard a private message

Posted: 2003-May-21 07:50
Edit Message Delete Message Reply to this message

Could give you a working example code that uses the mysql_data_seek to move the pointer and sets the number of results you wish to display, but it might be a little confusing to look at unless you see refer to the actual working web page application of it online.



NEntropy
Joined: Dec 08, 1999
# Posts: 1117

View the profile for NEntropy Send NEntropy a private message

Posted: 2003-May-21 23:12
Edit Message Delete Message Reply to this message

How about the example given in the PHP Manual? It looks complete to me...



davaddavad
Joined: Aug 02, 2001
# Posts: 928

View the profile for davaddavad Send davaddavad a private message

Posted: 2003-May-22 19:48
Edit Message Delete Message Reply to this message

I understand the select part so I guess passing the variable is keeping me stuck. smile



NEntropy
Joined: Dec 08, 1999
# Posts: 1117

View the profile for NEntropy Send NEntropy a private message

Posted: 2003-May-23 01:08
Edit Message Delete Message Reply to this message

Say you have a variable $offset. So, for next page, you'd have a link like page.php?offset=50.

in the page.php, you'd have code that would check to make sure that offset variable is set, and that it is integer, and issue the sql command like SELECT * FROM db LIMIT $offset, 10. The resulting page will return rows 51 to 60 (if offset was set to 50 as suggested above)



raul_ionescu
Joined: Feb 23, 2006
# Posts: 1

View the profile for raul_ionescu Send raul_ionescu a private message

Posted: 2006-Feb-23 11:04
Edit Message Delete Message Reply to this message

U could take a look at RC4PHPlink
wink



dirty_shame
Joined: Aug 28, 2005
# Posts: 191

View the profile for dirty_shame Send dirty_shame a private message

Posted: 2006-Feb-25 13:17
Edit Message Delete Message Reply to this message

davaddavad, you can't plug anything in until you know how many pages you have and how many results you wish to dosplay on every page...Not to mention the fact that you'll have to change (or create) your navigation to reflect the results.

Look, if you have 180,000 pages - like Google does on some topic - then you are going to have to break down the program to show X page links/page.

What are you doing? Retail or someting? I'll give you the first PHP code but it will span the whole page and blow it up if you have more results. Otherwise, I'll give you the code for hundreds of pages, set up in blocks of ten( or whatever you want).

I think the people here are confused about what you want. Please specify it. Whatever it is, it won't be plug-n-play 'till you modify it anyway.


You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. This is a private forum, for which you do not have permissions.

If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

If you cannot find this message, click here to Re-Send it.

If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions