Hello, I was looking at the pagination script (posted below) and found it to be gros,s and not very good at all especially when trying to customize it.
This is what the main page looks like:
<?php
include('config.php');
$per_page = 9;
//Calculating no of pages
$sql = "select * from messages";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
$pages = ceil($count/$per_page)
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript" src="jquery_pagination.js"></script>
<div id="loading" ></div>
<div id="content" ></div>
<ul id="pagination">
<?php
//Pagination Numbers
for($i=1; $i<=$pages; $i++)
{
echo '<li id="'.$i.'">'.$i.'</li>';
}
?>
</ul>
The top part of the code gets the results from the mysql db and than uses this information to display the numbers in the body of this page.
I am trying to put something like this on a separate page like count_page.php and then just include it.
I guess my question is, if there is a better way of doing the above with better structure. A better way to go through the db and count the results and display the appropriate numbers. The above seems messy.
Thanks for any help or suggestions on this.