Jump to content


Recommended Posts

i am trying to create a pagination, but when i run this script my browser wont let me do it.


Error from my browser: This webpage has a redirect loop



the script:


include "connect.php";
$per_page = 5;
$pages_query = mysql_query("SELECT COUNT(id) FROM bruker") or die(mysql_error());
$pages = ceil(mysql_result($pages_query, 0) / $per_page);
if(!isset($_GET['pages'])) {
header("location: pagination.php?page=1");
} else {
$page = $_GET['page'];
$start = (($page - 1) * $per_page);
$bruker = mysql_query("SELECT * FROM bruker LIMIT $start, $per_page");
while($row = mysql_fetch_assoc($bruker)) {
$bruker = $row['bruker'];
echo $bruker . "<br />";
Link to comment
Share on other sites

because that's what you're telling it to do here. you should probably change pages to page

if(!isset($_GET['pages'])) {    header("location: pagination.php?page=1");
Edited by thescientist
Link to comment
Share on other sites

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...