Home > Backend Development > PHP Tutorial > PHP paging, select all, inverse selection, unselect all, batch delete_PHP tutorial

PHP paging, select all, inverse selection, unselect all, batch delete_PHP tutorial

WBOY
Release: 2016-07-13 17:49:09
Original
1246 people have browsed it

/**
* User management
* 2011/8/22
* kcj
*
**/ 
include "isLogin.php"; 
include "../conn/conn.php"; 
$sql="select * from user"; 
$rst=mysql_query($sql); 
$totalnum=mysql_num_rows($rst); 
$pagesize=5; 
$page=$_GET['page']; 
if($page==''){ 
    $page=1; 

$begin=($page-1)*$pagesize; 
$pagecount=ceil($totalnum/$pagesize); 
?> 
 
 
 
     
         
        无标题文档 
         
         
         
         
         
         
                                                       



        

Background Management-& GT; Management User
             

              

                                                                                                                                                                                                                                                        in                                                                                                                                                                                                                                              ​                                                                                                                                                                                                            ​                                                                                                                                                                                                                   Remark name
Registration time
Operation
                                                                                                                                                                                                                                                                                                                        If (ISSET ($ _ Post ['Deell'])) {// Batch delete
$ids=$_POST['dell'];
$ IDS = Implode (",", $ IDs); // Implode function combines array elements as a string.
$sql="delete from user where id in ($ids)";
mysql_query($sql);
                                                                                                                                                                                                                                                                             If(isset($_GET['del'])){
$id=$_GET['del'];
$sql="delete from user where id=".$id;
mysql_query($sql);
                                                                                                                                                                                                                       
                          
                         $sql="select * from user order by id limit $begin,$pagesize"; 
                         $rst=mysql_query($sql); 
                         while ($row=mysql_fetch_array($rst)){ 
                          
                         ?> 
                       
  •  
                                 
                             
                            
                               
     
                                 
                                  
                                 
                             
                                【修改】 
                               
                                【删除】 
                                                         } 
                                ?> 
                               
     
                                                     } 
                            ?> 
                         
                             
                         
                       
  •  
                              
                                全选/反选/全不选  选中项:  
                                 
                                   
                            
     
                             
                                共 个用户,共页 
                                ">首页 
           
                                上一页 
                                                            for($i=1;$i<=$pagecount;$i++){    //$i<=$pagecount(必须是<=)  
                                    echo "[".$i."]"; 
                                } 
                                 
                                ?> 
                                下一页 
                                ">尾页 
                           
     
                       
  •  
                      
               
     
                       
     
           
     
         
     
    /**
    * User management
    * 2011/8/22
    * kcj
    *
    **/
    include "isLogin.php";
    include "../conn/conn.php";
    $sql="select * from user";
    $rst=mysql_query($sql);
    $totalnum=mysql_num_rows($rst);
    $pagesize=5;
    $page=$_GET['page'];
    if($page==''){
     $page=1;
    }
    $begin=($page-1)*$pagesize;
    $pagecount=ceil($totalnum/$pagesize);
    ?>



     
      
      无标题文档
      
      
      
      
      
      
      
     


     
      

          后台管理->管理用户
         
       

        

           

    •       用户名
            备注名
            注册时间
            操  作
           

    •                          
                   if(isset($_POST['dell'])){       //批量删除
                      $ids=$_POST['dell'];
                    $ids=implode(",", $ids);   //implode函数 把数组元素组合为一个字符串。
                    $sql="delete from user where id in ($ids)";
                    mysql_query($sql);
                   }
                  
                   if(isset($_GET['del'])){
                    $id=$_GET['del'];
                    $sql="delete from user where id=".$id;
                    mysql_query($sql);
                   }
                  
                  
                   $sql="select * from user order by id limit $begin,$pagesize";
                   $rst=mysql_query($sql);
                   while ($row=mysql_fetch_array($rst)){
                  
                   ?>
            

    •        
            
            
             

             
                      
             
            
             【修改
             
             【删除
                           }
             ?>
             

                          }
            ?>
           
            
           
           

    •       
             全选/反选/全不选  选中项:
             
              
            

            
             共 个用户,共
             ">首页
        
             上一页
                     for($i=1;$i<=$pagecount;$i++){    //$i<=$pagecount(必须是<=)
              echo "[".$i."]";
             }
             
             ?>
             www.2cto.com 下一页
             ">尾页
            

           

    •     
     
       

                       
      

     
    [php] //如果大家有什么不明白,可以留下你的疑问,我将尽快给予回复! 


    摘自 chaojie2009的专栏

    www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478361.htmlTechArticle?php /*** User Management * 2011/8/22 * kcj * **/ include isLogin.php; include ../conn/conn.php; $sql=select * from user; $rst=mysql_query($sql); $totalnum=mysql_num_rows($rst); $pa...
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template