Jump to content

next button help isnt pagination


asdfer

Recommended Posts

trying to set up a database to show profiles of users with ids.

 

for example: some id#s include: 10000, 10024, 10067, 10197, 10374, etc. there is no set order in incrementing the numbers..

 

what i want to do is have a previous and next button at the top of the page. for previous, i'm keeping the simple "javascript:history.go(-1)" (for right now anyway).

 

but for the NEXT button, i dont know what to do. i want the next button to read from an external file, i have a txt file right now just to keep the ids in. there are over 600 ids. and the info of each link displays in an iframe below. ... if it were working properly

 

thanks for any help!

Link to comment
https://forums.phpfreaks.com/topic/120020-next-button-help-isnt-pagination/
Share on other sites

well assuming that your page is somethign liek list.php?id=<???>

 

then:

 

SELECT id FROM table  WHERE id > $currentID LIMIT 1

will return the id for the next highest value ( or you can inverse it so that you get the id below the current one)....

 

simply execute that and then echo the value into the javascript

 

so assuming youve done all your querying...

 

if your javascript is in another file.. youll have to rename it so somethign liek Javascript.php  and add

<?php

header("text/JavaScript");

?>

at the top.

 

 

then its just:

 

echo "window.location.href = list.php?id=".$nextID.";";

 

that shoudl work for you

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.