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
paginating doesn't work?
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="Markshall" data-source="post: 199974" data-attributes="member: 1872"><p>No comments were showing because you ran an if statement saying</p><p> </p><p>[php]if ($numrows != 0)[/php]</p><p> </p><p>$numrows hadn't even been declared so it wouldn't have shown anything.</p><p> </p><p>As far as I know, this should work.</p><p> </p><p>[PHP]<?php</p><p>$getComments = mysql_query("SELECT * FROM cms_comments WHERE article = '".filter($_GET['id'])."' ORDER by id DESC");</p><p>?></p><p><div class="habblet-container "></p><p><div class="cbb clearfix notitle "></p><p><div id="article-wrapper"><h2>Comments <?php echo mysql_num_rows($getComments); ?></h2></p><p><div class="article-meta"></div></p><p><div class="article-body"></p><p><?PHP</p><p>$p1 = 3; // thanks PHPAcademy for Pagination tuts <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'] : 1;</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> echo '<tr></p><p> <td width="90px" valign="top"></div></p><p> <div style="height: 65px;width: 50px;float: left;overflow: hidden;"></p><p> <div style="float:left"><img position:absolute; src="http://www.habbo.fr/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=s&direction=2&head_direction=3&gesture=sml"></div></p><p> </td></p><p> </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> </p><p> <tr></p><p> <td width="80px" valign="top"></td></p><p> </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>?>[/PHP]</p></blockquote><p></p>
[QUOTE="Markshall, post: 199974, member: 1872"] No comments were showing because you ran an if statement saying [php]if ($numrows != 0)[/php] $numrows hadn't even been declared so it wouldn't have shown anything. As far as I know, this should work. [PHP]<?php $getComments = mysql_query("SELECT * FROM cms_comments WHERE article = '".filter($_GET['id'])."' ORDER by id DESC"); ?> <div class="habblet-container "> <div class="cbb clearfix notitle "> <div id="article-wrapper"><h2>Comments <?php echo mysql_num_rows($getComments); ?></h2> <div class="article-meta"></div> <div class="article-body"> <?PHP $p1 = 3; // thanks PHPAcademy for Pagination tuts <3 $pages = mysql_query("SELECT COUNT(id) FROM cms_comments"); $p2 = ceil(mysql_result($pages, 0) / $p1); $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; $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); 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://www.habbo.fr/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=s&direction=2&head_direction=3&gesture=sml"></div> </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>'; } ?>[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
paginating doesn't work?
Top