MY DEMO
I want a pagination according to the results coming from wordpress database...This is all done on my options page of wordpress plugin..
My code to re
Take this https://stackoverflow.com/a/16358219/1596547 and adopt it to your needs like:
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$limit = 5; // number of rows in page
$offset = ( $pagenum - 1 ) * $limit;
$total = $wpdb->get_var( "SELECT COUNT(`id`) FROM `wp_dive`" );
$num_of_pages = ceil( $total / $limit );
$result = $wpdb->get_results( "SELECT `id`,`name_cust`,`gender_cust`,`dob_cust` FROM `wp_dive` LIMIT $offset, $limit" );
$data_html = '';
foreach( $result as $results )
{
$id=$results->id;
$name= $results->name_cust;
$gender= $results->gender_cust;
$dob= $results->dob_cust;
?>
";?>
". $id."";?>
". $name."";?>
".$gender."";?>
". $dob ."";?>
"?>
add_query_arg( 'pagenum', '%#%' ),
'format' => '',
'prev_text' => __( '«', 'aag' ),
'next_text' => __( '»', 'aag' ),
'total' => $num_of_pages,
'current' => $pagenum
) );
if ( $page_links ) {
echo '' .
$page_links . '';
}