pagination in table in wordpress

Question

prefix.’dbp_tb_branch’;
$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(*) as total from $table_name” );
$num_of_pages = ceil( $total / $limit );

$rows = $wpdb->get_results( “SELECT id,branch from $table_name limit $offset, $limit” );
$rowcount = $wpdb->num_rows;

?>

Views of Branches

ID
Branch Name
Delete

prefix.’dbp_tb_branch’;
if(isset($_POST[‘del_btn’]) AND isset($_POST[‘delete’]))
{
for($i=0; $idelete($table_name,
array(
‘id’=>$del_id
)
);
}
}
$DBP_results=$wpdb->get_results(“SELECT * FROM $table_name”);
if($rowcount>0){
foreach($DBP_results as $DBP_row){
$id=$DBP_row->id;
$branch=$DBP_row->branch;
?>

“>

No records found”;
} ?>

$page_links = paginate_links( array(
'base' => add_query_arg( 'pagenum', '%#%' ),
'format' => '',
'prev_text' => __( '«', 'text-domain' ),
'next_text' => __( '»', 'text-domain' ),
'total' => $num_of_pages,
'current' => $pagenum
) );

if ( $page_links ) {
echo '<div class="tablenav" style="width: 99%;">
<div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
}

}

?>

pagination is not working . I have tried many times.could anyone help me?

0
, , Arshpreet Venveru 3 years 2020-07-14T06:12:05-05:00 0 Answers 68 views 0

Leave an answer

Browse
Browse