Jump to content

Recommended Posts

Now if I could only get this simple pagination to work!! any one see what i'm doing wrong?

 

if (isset($_GET['galno'])) {
   $pageno = $_GET['galno'];
} else {
   $pageno = 1;
}
$pageno = (int)$pageno;
if ($pageno > $num_rows) {
   $pageno = $num_rows;
}
if ($pageno < 1) {
   $pageno = 1;
}
if ($pageno == 1) {
   echo " FIRST PREV ";
} else {
   echo " <a href='./index.php#Community?galno=1'>FIRST</a> ";
   $prevpage = $pageno - 1;
   echo " <a href='./index.php#Community?galno=$prevpage'>PREV</a> ";
}
if ($pageno == $num_rows) {
   echo " NEXT LAST ";
} else {
   $nextpage = $pageno + 1;
   echo " <a href='./index.php#Community?galno=$nextpage'>NEXT</a> ";
   echo " <a href='./index.php#Community?galno=$num_rows'>LAST</a> ";
} 
echo " ( Page $pageno of $num_rows ) ";
$num = $pageno;

 

$num_rows = the number of galleries I want to display in my database

$num = is in the gallery code to pick out what gallery to show

#Community = the page "container" where the galleries are located

 

The issue is that the $pageno always = 1.. that means the if($_GET(clause)) is never true? and i have no idea why??

The issue is that the $pageno always = 1.. that means the if($_GET(clause)) is never true? and i have no idea why??

 

It means one of three things:

 

1) isset($_GET['galno']) is always evaluating to false (maybe your variable is named something other than galno?)

2) $num_rows is less than or equal to 1

3) $_GET['galno'] is equal to 1.

 

Your problem lies in one of these three things.

What's a paginate suppost to do?

 

I have never heard of it.  Gt a link or something or is it simple to explain?

 

Its a term used to shorten search results, etc. Best google a popular term and check down the bottom of the page (Prev 1 2 3 4 Next).

Imagine if every google search result was on the one page.

 

As for the OP, I would suggest die()-ing your major variables so see what their actually values are, or maybe var_dump(). And then doing this inside your condition statements to see if they're actually executing.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.