Pagination for wordpress admin panel in coustom menu -


i have make wordpress plugin in want fetch data database , need pagination used digg style pagination when click on next link of pagination "you not have sufficient permissions access page." error occour plz problem code

<?php include('pagination.class.php'); ?> <?php /* plugin name:register data description:pagination plugin wordpress admin panel. author:pawan sharma author uri:  */ $object = new yourplugin();  //add hook admin header check if user has agreed terms , conditions. //add_action('admin_head', array($object, 'adminheader'));  //add footer code //add_action( 'admin_footer', array($object, 'adminfooter'));  // hook adding admin menus add_action('admin_menu', array($object, 'addmenu'));  //this create [yourshortcode] shortcode add_shortcode('yourshortcode', array($object, 'shortcode'));  class yourplugin{  /** * create menu item under option menu * @see http://codex.wordpress.org/function_reference/add_options_page */ public function addmenu(){ add_options_page('regeter data', 'regeter data', 'manage_options', 'my-unique-identifier', array($this, 'optionpage')); }  /** * add html , php option page * @see http://codex.wordpress.org/function_reference/add_options_page */ public function optionpage(){ $items = mysql_num_rows(mysql_query("select * wp_register_form;")); // number of total rows in database  if($items > 0) { $p = new pagination; $p->items($items); $p->limit(5); // limit entries per page $p->target("$this->target?page=list_record"); $p->currentpage($_get[$p->paging]); // gets , validates current page $p->calculate(); // calculates show $p->parametername('paging'); $p->adjacents(1); //no. of page away current page  if(!isset($_get['paging'])) { $p->page = 1; } else { $p->page = $_get['paging']; }  //query limit paging $limit = "limit " . ($p->page - 1) * $p->limit . ", " . $p->limit;  } else { echo "no record found"; }  ?> <?php //now we'll display list of records ?> <div class="wrap"> <h2>list of records</h2>  <div class="tablenav"> <div class='tablenav-pages'> <?php echo $p->show(); // echo out list of paging. ?> </div> </div>  <table class="widefat"> <thead> <tr> <th>name</th> <th>city</th> <th>mobile no</th> <th>email</th> <th>address</th> <th>view</th> </tr> </thead> <tbody> <?php $sql = "select * wp_register_form $limit"; $result = mysql_query($sql) or die ('error, query failed');  if (mysql_num_rows($result) > 0 ) { while ($row = mysql_fetch_assoc($result)) { $name = $row['customer_name']; $city = $row['customer_city']; $phone = $row['customer_phone']; $email = $row['customer_email']; $address = $row['customer_address']; $id = $row['customer_id'];?>  <tr> <td><?php echo $name; ?></td> <td><?php echo $city; ?></td> <td><?php echo $phone; ?></td> <td><?php echo $email; ?></td> <td><?php echo $address; ?></td> <td><?php echo "<a href='http://localhost/wor/wp-content/themes/mitfitness/single_details.php?id=".$id."'>view details</a>"?></td> </tr> <?php } } else { ?> <tr> <td>no record found!</td> <tr> <?php } ?> </tbody> </table> </div> <?php }  /** * add code returned wherever put shortcode * @see http://codex.wordpress.org/shortcode_api */ public function shortcode(){ return "add image , html here..."; } } ?> 

there mistake in target

<?php include('pagination.class.php'); ?> <?php /* plugin name:register data description:pagination plugin wordpress admin panel. author:pawan sharma author uri:  */ $object = new registerdata();  //add hook admin header check if user has agreed terms , conditions. //add_action('admin_head',  array($object, 'adminheader'));  //add footer code //add_action( 'admin_footer',  array($object, 'adminfooter'));  // hook adding admin menus add_action('admin_menu',  array($object, 'addmenu'));  //this create [yourshortcode] shortcode add_shortcode('yourshortcode', array($object, 'shortcode'));  class registerdata{      /**      * create menu item under option menu      * @see http://codex.wordpress.org/function_reference/add_options_page      */     public function addmenu(){         add_options_page('regeter data', 'regeter data', 'manage_options', 'register_data', array($this, 'optionpage'));     }      /**      * add html , php option page      * @see http://codex.wordpress.org/function_reference/add_options_page      */     public function optionpage(){        $items = mysql_num_rows(mysql_query("select * wp_register_form;")); // number of total rows in database          if($items > 0) {         $p = new pagination;         $p->items($items);         $p->limit(5); // limit entries per page         $p->target("$this->target?page=register_data");         $p->currentpage($_get[$p->paging]); // gets , validates current page         $p->calculate(); // calculates show         $p->parametername('paging');         $p->adjacents(1); //no. of page away current page          if(!isset($_get['paging'])) {             $p->page = 1;         } else {             $p->page = $_get['paging'];         }          //query limit paging         $limit = "limit " . ($p->page - 1) * $p->limit  . ", " . $p->limit;  } else {     echo "no record found"; }  ?>  <?php //now we'll display list of records  ?> <div class="wrap">     <h2>list of records</h2>  <div class="tablenav">     <div class='tablenav-pages'>         <?php echo $p->show();  // echo out list of paging. ?>     </div> </div>  <table class="widefat"> <thead>     <tr>         <th>name</th>         <th>city</th>                  <th>mobile no</th>         <th>email</th>         <th>address</th>         <th>view</th>     </tr> </thead> <tbody> <?php  $sql = "select * wp_register_form $limit"; $result = mysql_query($sql) or die ('error, query failed');  if (mysql_num_rows($result) > 0 ) {     while ($row = mysql_fetch_assoc($result)) {             $name            = $row['customer_name'];             $city  = $row['customer_city'];             $phone       = $row['customer_phone'];             $email       = $row['customer_email'];             $address       = $row['customer_address'];             $id       = $row['customer_id'];?>          <tr>             <td><?php echo $name; ?></td>             <td><?php echo $city; ?></td>             <td><?php echo $phone; ?></td>             <td><?php echo $email; ?></td>              <td><?php echo $address; ?></td>              <td><?php echo "<a href='$this->target?page=register_data&view=".$id."'>view details</a>"?></td>                     </tr> <?php } } else { ?>         <tr>         <td>no record found!</td>         <tr>  <?php } ?> </tbody> </table> </div> <?php      }      /**      * add code returned wherever put shortcode      * @see http://codex.wordpress.org/shortcode_api      */     public function shortcode(){         return "add image , html here...";     }  } ?> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -