| | #1 |
| Warrior Member Join Date: 2013
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
Here is the my code. I have created the code but everything is ok... but pagination is not working. Please Give a solution.... Here is the code: <script type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> <?php $page_url = 'managepageuser.php'; $display_per_page = constant("DISPLAYPERPAGE"); if(isset($_GET['pages']) && $_GET['pages']!="1") { $pages = $_GET['pages']; $from_limit = ($pages-1) * $display_per_page; $to_limit = $from_limit + $display_per_page; } else { $pages = 1; $from_limit = 10; $to_limit = $from_limit + $display_per_page; } if($to_limit > $num_lists) { $to_limit = $num_lists; } if($num_lists > 0) { $total_pages = intval($num_lists / $display_per_page); if($total_pages!='0') { if(($num_lists % $display_per_page) !='0') { $total_pages = $total_pages +1; } } $prev = $pages - 1; $next = $pages + 1; $first = 1; $last = $total_pages; $pages_cnt = 1; if($total_pages > $pages_cnt) { $paging_txt .= "<a href='$page_url?pages=$first'>«« FIRST</a> | "; if($pages >1) { $paging_txt .= " <a href='$page_url?pages=$prev'>«PREVIOUS</a> | "; } $paging_txt .= "<select name=\"menu1\" onchange=\"MM_jumpMenu('parent',this,0)\">"; while($pages_cnt <= $total_pages) { //$paging_txt .= " | <a href='$page_url?pages=$pages_cnt'>".$pages_cnt."</a>"; $paging_txt .= "<option value='".$page_url."?pages=".$pages_cnt."'"; if($pages_cnt == $_GET['pages']) { $paging_txt.= "selected"; } $paging_txt.= ">".$pages_cnt."</option>"; $pages_cnt++; } $paging_txt .= "</select>"; if($pages > 0 && $pages < $total_pages) { $paging_txt .= " | <a href='$page_url?pages=$next'>NEXT»</a>"; } if($pages !=$total_pages) { $paging_txt .= " | <a href='$page_url?pages=$last'>LAST »»</a>"; } } } ?> <?php if((isset($_GET['cmd'])) && ($_GET['cmd'] == "status")) { mysql_query("update $from_limittabledouser set driver_status='".$_GET['status']."' where driver_id='".$_GET['id']."'") or die(mysql_error()); } if((isset($_GET['cmd'])) && ($_GET['cmd'] == "del")) { mysql_query("delete from $tabledouser where id='".$_GET['id']."'") or die(mysql_error()); } /**** FETCH ALL DRIVER RECORDS ***/ if($_SESSION['admintype'] == 'superadmin') { $sql_list = mysql_query("select * from $tabledouser order by user_name ASC") or die(mysql_error()); $num_list = mysql_num_rows($sql_list); } else { $sql_list = mysql_query("select * from $tabledouser order by user_name ASC") or die(mysql_error()); $num_list = mysql_num_rows($sql_list); } ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php if(isset($_GET['success_msg'])) { ?> <tr> <td valign="top" align="center" class="greentxt"><?php echo $_GET['success_msg']; ?></td> </tr> <?php } ?> <?php if($num_list > 0) { ?> <tr> <td valign="top" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="rowstbl display" rel="datatable" id="example"> <thead> <tr> <th width="6%" align="center" nowrap="nowrap"> </th> <th width="11%" align="center" nowrap="nowrap">ID </th> <th width="8%" align="center" nowrap="nowrap">User Name </th> <th width="8%" align="center" nowrap="nowrap">Full Name</th> <th width="28%" align="center" nowrap="nowrap">Email</th> <th width="17%" align="center" nowrap="nowrap">Mobile Number </th> <th width="8%" align="center" nowrap="nowrap">Time Login</th> <th width="10%" align="center" nowrap="nowrap">Edit</th> <th align="center">Delete</th> </tr> <tbody> <?php while($res_list = mysql_fetch_array($sql_list)) { $current_time = date("Y-m-d H:i:s"); $last_current_time = date("Y-m-d H:i:s",mktime(date("H"),date("i")-1,date("s"),date("m"),date("d"),date("Y"))); ?> <tr> <td align="center"><?php if((isset($_GET['id'])) && ($_GET['id'] == $res_list['id'])) { ?><img src="images/tick.png" /><?php } ?></td> <td align="center"><?php echo $res_list['id']; ?></td> <td align="center"><?php echo $res_list['user_name']; ?></td> <td align="center"><?php echo $res_list['full_name']; ?></td> <td align="center"><?php echo $res_list['email']; ?></td> <td align="center"><?php echo $res_list['cntrycode'].'-'.$res_list['mobile']; ?></td> <td align="center"><?php echo $res_list['create_at']; ?></td> <td align="center"><a href="javascript:confirmbox_edit(<?php echo $res_list['id']; ?>)"><img src="images/edit.png" width="29" height="29" border="0" /></a></td> <td align="center"><a href="javascript:confirmbox(<?php echo $res_list['id']; ?>)"><img src="images/delete.png" width="29" height="29" border="0" /></a></td> </tr> <?php } ?> </tbody> </table></td> </tr> <?php } else { ?> <tr> <td align="center" class="dtlboxbg tdmargin redtxt"><div align="center">NO RECORD FOUND</div></td> </tr> <?php } ?> </table> |
| |
|
| Bookmarks |
| Tags |
| pagination, working |
| |