darkfreaks Posted February 9, 2008 Share Posted February 9, 2008 it shows previous and next links but wont show 25 entries per page any ideas ??? <?php $limit = 25; $query_count = "SELECT count(*) FROM vc_covenmessages WHERE catid='$catid'"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); if(empty($page)){ $page = 1; } $limitvalue = $page * $limit - ($limit); $query = "SELECT * FROM vc_covenmessages WHERE catid='$catid' ORDER BY `id` LIMIT $limitvalue,25"; $result = mysql_query($query) or die("Error: " . mysql_error()); if(mysql_num_rows($result) == 0){ echo(""); } while($row = mysql_fetch_array($result)){ } if($page != 1){ $pageprev = $page--; echo("<a href=\"board.php?catid=$catid&covid=$covid&page=$pageprev\">PREV".$limit."</a> "); }else{ echo("PREV".$limit." "); } $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"board.php?catid=$catid&covid=$covid&page=$i\">$i</a> "); } } if(($totalrows % $limit) != 0){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"board.php?catid=$catid&covid=$covid&page=$i\">$i</a> "); } } if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page++; echo("<a href=\"board.php?catid=$catid&covid=$covid&page=$pagenext\">NEXT".$limit."</a> "); }else{ echo("NEXT".$limit); } mysql_free_result($result); mysql_close(); include ('config.php'); $query4=trim(mysql_real_escape_string($query4)); $query4 = "SELECT * FROM vc_covenmessages WHERE catid='$catid' ORDER BY `id` LIMIT $limitvalue,25"; $result4 = mysql_query($query4) or die("Error: " . mysql_error()); $numrows=mysql_num_rows($result4); mysql_close(); $i=0; while ($i < $num) { $id = mysql_result($result4,$i,"id"); $username = mysql_result($result4,$i,"username"); $date = mysql_result($result4,$i,"date"); $message = mysql_result($result4,$i,"message"); $title = mysql_result($result4,$i,"title"); echo "<table width=\"60%\" cellpadding=\"0\" cellspacing=\"0\" class=\"cmessage\"> <tr valign='top'> <td width=\"10%\" align=\"center\"> <a href=\"../profile/$username\"><br>$username</a><br>"; if ($status=="owner") { echo "<input type='checkbox' name='id' value='$id'>"; }; if ($status=="admin") { echo "<input type='checkbox' name='id' value='$id'>"; }; echo "</td> <td width=\"50%\"> <table border=\"0\" width=\"100%\" class=\"titlebar\"> <tr><td align=\"left\"><B>$title</B></td><td align=\"right\"> $date </td></tr> </table> $message </td></tr> </table> "; $i++; };?> Quote Link to comment 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.