CloudSex13 Posted April 15, 2009 Share Posted April 15, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/154142-solved-pagination-wont-work/ Share on other sites More sharing options...
MasterACE14 Posted April 15, 2009 Share Posted April 15, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/154142-solved-pagination-wont-work/#findComment-810274 Share on other sites More sharing options...
CloudSex13 Posted April 15, 2009 Author Share Posted April 15, 2009 lol, nice. In addition to that, I accidentally capitalized a variable $n. Fixed: for ($n = 1; $n >= ($thingamount / $perpage); $n++) { $thingpages = "[{$n}]"; } Oh, gosh darn myself. Anyone? Blah. Quote Link to comment https://forums.phpfreaks.com/topic/154142-solved-pagination-wont-work/#findComment-810278 Share on other sites More sharing options...
CloudSex13 Posted April 15, 2009 Author Share Posted April 15, 2009 Any ideas... anyone? lol. :/ Quote Link to comment https://forums.phpfreaks.com/topic/154142-solved-pagination-wont-work/#findComment-810677 Share on other sites More sharing options...
premiso Posted April 15, 2009 Share Posted April 15, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/154142-solved-pagination-wont-work/#findComment-810679 Share on other sites More sharing options...
CloudSex13 Posted April 15, 2009 Author Share Posted April 15, 2009 Sweet, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/154142-solved-pagination-wont-work/#findComment-810683 Share on other sites More sharing options...
sasa Posted April 15, 2009 Share Posted April 15, 2009 change for ($n = 1; $n >= ($thingamount / $perpage); $n++) { $thingpages = "[{$n}]"; } tochange for ($n = 1; $n <= ($thingamount / $perpage); $n++) { $thingpages .= "[{$n}]";// or $thingpages[] = "[{$n}]"; } Quote Link to comment https://forums.phpfreaks.com/topic/154142-solved-pagination-wont-work/#findComment-810886 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.