Could anyone explain to me how to implement pagination for the content we have in a WordPress database? We have around 2000 records and I don't want to display them in a single page.
Could anybody help? This is the code i have through this i can display the contents of my database
<?php
require_once( dirname(__FILE__) . '/wp-load.php' );
global $wpdb;
$table = $wpdb->prefix."car_saver";
$data = $wpdb->get_results("SELECT * FROM " . $table );
if(count($data))
{
?>
<table width="700" cellspacing="0" border="0">
<thead>
<tr>
<th>id</th>
<th>Make</th>
<th>Model</th>
<th>Sub Model</th>
<th>MSRP</th>
<th>Utility</th>
<th>Feature</th>
<th>Year</th>
</tr>
</thead>
<tfoot>
<tr>
<th>id</th>
<th>Make</th>
<th>Model</th>
<th>Sub Model</th>
<th>MSRP</th>
<th>Utility</th>
<th>Feature</th>
<th>Year</th>
</tr>
</tfoot>
<tbody>
<?php
foreach($data as $p): ?>
<tr>
<td align="center"><?php echo $p->car_id; ?></td>
<td align="center"><?php echo $p->Make; ?></td>
<td align="center"><?php echo $p->Model; ?></td>
<td align="center"><?php echo $p->subModel; ?></td>
<td align="center"><?php echo $p->MSRP; ?></td>
<td align="center"><?php echo $p->Utility; ?></td>
<td align="center"><?php echo $p->Feature; ?></td>
<td align="center"><?php echo $p->Year; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
}
else echo "data not found";
?>