Jump to content

Next button


everlifefree

Recommended Posts

ok i'm looking to make a next button for my site that goes up looks at the id of the page your on and then when you click the next button it takes you to the next one in line it the database. and it can't just go 1, 2, 3, 4, ect. because there are missing variable from deletions some it'd need to be able to read like this 1, 2, 5, 6, 7, 12, ect. (you get the point of just serveal missing numbers between.

Link to comment
https://forums.phpfreaks.com/topic/94444-next-button/
Share on other sites

Here's the code I attempted but I get all it puts in {ezine.id2} is the number 1 and that isn't right! Can anyone tell me where I went wrong??

 

if (isset($_GET["id"])) 
	$row2 = myF(myQ("
		SELECT * 
		FROM `[x]gallery` 
		WHERE 'id' > '{$_GET["id"]}' 
		AND `processed` = '1'
		ORDER BY 'id' ASC
		LIMIT 1
	"));

$tpl -> AssignArray(array(
	"ezine.id2" => $row2["id"],
));

Link to comment
https://forums.phpfreaks.com/topic/94444-next-button/#findComment-485338
Share on other sites

I'm about to go on a trip with the wife so I only have about one minute to post. I dont know what is wrong with your current code, but use this:

 

if(isset($_GET['page_id']))
{
   $query = "SELECT page_id FROM pages WHERE page_id > " . $_GET['page_id'] . " ORDER BY page_id ASC LIMIT 1";
}
else
{
    $query = "SELECT page_id FROM pages WHERE page_id > 1 ORDER BY page_id ASC LIMIT 1";
}
// Do your mysql query here
echo "<a href=\"page_name?page_id=" . $page_id_taken_from_database . "\">NEXT PAGE</a>";

Link to comment
https://forums.phpfreaks.com/topic/94444-next-button/#findComment-486603
Share on other sites

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.