We help IT Professionals succeed at work.

Previous / Next Links

Phirus
Phirus asked
on
Does anybody know/know where I can get a good, solid, easily customisable "prev/next" link script. I have been looking for quite sometime, and dont really have the time to go and try and create one.

I have looked at some examples on sites but to be honest, they aren't very good.

Hoping someone can shed some light on this issue...


PhIrUs
Comment
Watch Question

It depends what you want to get with prev/next. Is it another HTML-Page (i.e. just another link to another page$k.html) or do you build the page from a database and want to show the next page from the mySQL Table?

There is no "universal prev/next" button that you just can plug into your page, you must at least tell the script what will happen when you go "next" :-)

Marian

Author

Commented:
I want the page to be built from the database...

Lets say I have 6 articles > It should then reference these accordingly through the SQL table...

Know what I mean.

phIrUs
I would use a class to encapsulate the prev/next function as a method. The class should have knowledge about the table, the number of items and how to retrieve the items. Since this depends on the structure and content of your table. There are some classes available that use an auto_increment field to do the navigation like this:
http://phpclasses.upperdesign.com/browse.html/package/106

Maybe you do a search on this domain to find another class like this. I think it would be much easier to implement the class by yourself than looking for a generic one.

Marian
Hey its very simple to put into the script just do like it

<?
if(isset($start)){
$next_start=0;
}
$fetch_row=10;
mysql_query("selec * from tb_name);
mysql_query("Select * from tb_name limit ($next_start, $fetch_row)");
if ($start!=0){?>
<a href="yourpage.php?next_start=<?echo $next_start-$fetch_row?>>Previous</a>
<?}
if($next_fetch>mysql_num_row($st)){?>
<a href="yourpage.php?next_start=<?echo $next_start+$fetch_row?>>Previous</a>
<?}?>


Harry
Commented:
Here is what you are looking for

http://www.hotscripts.com/Detailed/11933.html

Jimmy

Commented:
or this:

http://phpdeveloper.org/tutout.php?num=31

Good luck!

Calin

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split  harwantgrewal, and Jimmy282

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

aolXFT
EE Cleanup Volunteer

Explore More ContentExplore courses, solutions, and other research materials related to this topic.