vaulient2
New Member
- Mar 12, 2013
- 27
- 3
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
Here's a screenie
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> ';
}
}
?>
Here's a screenie
You must be registered for see links