Jump to content

[SOLVED] Pagination won't work?


CloudSex13

Recommended Posts

Hi, thanks for reading. For some reason, I can't identify why the pagination will not appear on my page. Can anyone quickly proof my code? Maybe I got tired...

 

lol.

 

Erg... thanks.

 

$things = mysql_query("SELECT * FROM Things WHERE AccountID='$saID'");

$thingamount = mysql_num_rows($things);
$perpage = 5;
$t = 0;

while ($t <= 5 && $row == mysql_fetch_row($things))
{
$t+=1;
$i+=1;
}

for ($N = 1; $n >= ($thingamount / $perpage); $n++)
{
  $thingpages = "[{$n}]";
}

 

I'm echoing $thingpages below.

Link to comment
Share on other sites

hmmm, that's not how I would have done it.

 

you can change this...

<?php
while ($t <= 5 && $row == mysql_fetch_row($things))
{
$t+=1;
$i+=1;
}

to this...

<?php
while ($t <= 5 && $row == mysql_fetch_row($things))
{
$t++;
$i++;
}

 

besides that I can't see anything wrong, I'm still waking up lol

Link to comment
Share on other sites

Honestly, that code is a mess and looks like it is done wrong. I would suggest reading a pagination tutorial which one can be found here

 

As it does seem you do not know how to do it. You should only pull data out of the query that you need, not everything, which the above tutorial will show you how to do.

Link to comment
Share on other sites

change

for ($n = 1; $n >= ($thingamount / $perpage); $n++)
{
  $thingpages = "[{$n}]";
}

tochange

for ($n = 1; $n <= ($thingamount / $perpage); $n++)
{
  $thingpages .= "[{$n}]";// or $thingpages[] = "[{$n}]";
}

Link to comment
Share on other sites

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.