Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
davaddavad
Joined: Aug 02, 2001
# Posts: 928
|
Posted: 2003-May-20 21:12
Does anyone have a php next previous button tutorial they are willing to post?
|
 |
NEntropy
Joined: Dec 08, 1999
# Posts: 1117
|
Posted: 2003-May-20 23:17
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.
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
|
Posted: 2003-May-21 07:50
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
|
Posted: 2003-May-21 23:12
How about the example given in the PHP Manual? It looks complete to me...
|
 |
davaddavad
Joined: Aug 02, 2001
# Posts: 928
|
Posted: 2003-May-22 19:48
I understand the select part so I guess passing the variable is keeping me stuck.
|
 |
NEntropy
Joined: Dec 08, 1999
# Posts: 1117
|
Posted: 2003-May-23 01:08
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
|
Posted: 2006-Feb-23 11:04
U could take a look at RC4PHPlink
|
 |
dirty_shame
Joined: Aug 28, 2005
# Posts: 191
|
Posted: 2006-Feb-25 13:17
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:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- 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
|
|