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 post
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 post
Share on other sites
  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...