Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Almost done with pagination
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="vaulient2" data-source="post: 200709" data-attributes="member: 29433"><p>Hey guys , a few days ago I made a help thread for my pagination as it would not paginate , and I have to admit , I received great support , especially from Monsta and I thank you all. Well even if I didn't succeed even from the helps , I kept working on it and now I am in a state where it works , but only thing is that now , It shows all the contents and whne I click on the pagination pages ,it redirects me to the homepage of my localhost website.</p><p>Here's the code</p><p>[code]<?PHP</p><p>$p1 = 3; </p><p>$pages = mysql_query("SELECT COUNT(id) FROM cms_comments");</p><p>$p2 = ceil(mysql_result($pages, 0) / $p1);</p><p>$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 0;</p><p>$start = ($page - 1) * $p1;</p><p>if(mysql_num_rows($getComments) == 0) {</p><p> echo "No comments for this article!";</p><p>} else {</p><p>echo '<table width="528px">';</p><p> while($Comments = mysql_fetch_array($getComments)){</p><p> $getUserInfo = mysql_query("SELECT * FROM users WHERE username = '".$Comments['author']."'");</p><p>$userInfo = mysql_fetch_array($getUserInfo);</p><p>$nummy = mysql_query("SELECT * FROM cms_comments");</p><p>$numrows = mysql_num_rows($nummy);</p><p> echo '</p><p> <tr> </p><p> <td width="90px" valign="top"></div></p><p> <div style="</p><p>height: 65px;</p><p>width: 50px;</p><p>float: left;</p><p>overflow: hidden;</p><p>"></p><p> <div style="float:left"><img position:absolute; src="http://habbo.fr/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=2"></div></p><p> '; </p><p> echo ' </p><p> </td></p><p> <td width="427px" valign="top"></p><p> <i><a href="/me">'.$userInfo['username'].' </a></i> </p><p> <br /><br />'.$Comments['comment'].' </p><p> </td></p><p> </tr></p><p> <tr></p><p> <td width="80px" valign="top"> </p><p> </td></p><p> <td width="400px" align="right"> </p><p></div></div></div></div></p><p><br></p><p><div style="width:125%; height:1px; background-color:#ccc; margin-top:-17px;"></div></p><p> </td></p><p> </tr>';</p><p> }</p><p> echo '</table>';</p><p>}</p><p>echo "Pages: ";</p><p>if($p2 >= 1 && $page <= $p2){</p><p>for($x=1; $x<=$p2; $x++) {</p><p>echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'">'.$x.'</a> ';</p><p>}</p><p>}</p><p>?>[/code]</p><p> </p><p>Here's a screenie </p><p> </p><p><a href="http://prntscr.com/122yyu" target="_blank">http://prntscr.com/122yyu</a></p></blockquote><p></p>
[QUOTE="vaulient2, post: 200709, member: 29433"] Hey guys , a few days ago I made a help thread for my pagination as it would not paginate , and I have to admit , I received great support , especially from Monsta and I thank you all. Well even if I didn't succeed even from the helps , I kept working on it and now I am in a state where it works , but only thing is that now , It shows all the contents and whne I click on the pagination pages ,it redirects me to the homepage of my localhost website. Here's the code [code]<?PHP $p1 = 3; $pages = mysql_query("SELECT COUNT(id) FROM cms_comments"); $p2 = ceil(mysql_result($pages, 0) / $p1); $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 0; $start = ($page - 1) * $p1; if(mysql_num_rows($getComments) == 0) { echo "No comments for this article!"; } else { echo '<table width="528px">'; while($Comments = mysql_fetch_array($getComments)){ $getUserInfo = mysql_query("SELECT * FROM users WHERE username = '".$Comments['author']."'"); $userInfo = mysql_fetch_array($getUserInfo); $nummy = mysql_query("SELECT * FROM cms_comments"); $numrows = mysql_num_rows($nummy); echo ' <tr> <td width="90px" valign="top"></div> <div style=" height: 65px; width: 50px; float: left; overflow: hidden; "> <div style="float:left"><img position:absolute; src="http://habbo.fr/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=2"></div> '; echo ' </td> <td width="427px" valign="top"> <i><a href="/me">'.$userInfo['username'].' </a></i> <br /><br />'.$Comments['comment'].' </td> </tr> <tr> <td width="80px" valign="top"> </td> <td width="400px" align="right"> </div></div></div></div> <br> <div style="width:125%; height:1px; background-color:#ccc; margin-top:-17px;"></div> </td> </tr>'; } echo '</table>'; } echo "Pages: "; if($p2 >= 1 && $page <= $p2){ for($x=1; $x<=$p2; $x++) { echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'">'.$x.'</a> '; } } ?>[/code] Here's a screenie [url]http://prntscr.com/122yyu[/url] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Almost done with pagination
Top