| 
<?php
require_once "pagination.inc.php";
 $max_rows = 12;     //Maximum number of rows to be fetched from the database..
 $page_url = "index.php?option=com_spg&view=sentMessages";
 
 $pn = new pagination($no_vouchers,$max_rows);
 
 $db_limit = $pn->getLimit());    //Returns db limit e.g 0, 12;
 
 //Add the limit to your database query..
 $db = new mysqli( "hostname", "username", "password", "dbname" );
 
 $sql = "SELECT * FROM `products` LIMIT " . $db_limit . ";";
 $queried = $db->query( $sql );
 ?>
 <table style='width: 100%'>
 
 <?php while( $fetch = $queried->fetch_assoc() ): ?>
 <tr>
 <?php echo "<td>" . implode("</td>\n<td>", $fetch) . "</td>\n"; ?>
 </tr>
 <?php endif; ?>
 </table>
 <?php
 $data = $pn->getLink($page_url, $target); //Specifying $target Returns a Hashed link which invokes a javascript function called loadPn..
 //If not specified, it returns a raw hyperlink which;
 
 $data .= "<span class='right'>" . $pn->getPageLength() . "</span>";
 ?>
 
 |