全选和 筛选 以及 比较好用的 sql语句 高级查询

 
查询[条件并列用and]
select * from required where xuenian  like  '%年%' and teachercode=01   order by starttime  limit 0,2

修改  同时修改两个数据【数据使用逗号隔开】
update required  set teachercode = 02 ,majorcode = '201702' where ids = 5

select major,count(*)  from class where 1=1 group by major //分组查询

 

 5.4

<?php
$tt="sssss,ssrsss";
$t = explode(",", $tt);
$shuZ='  ';
foreach($t as $v)
{
    $shuZ.="   name like  '%".$v."%'  or";
}
$str = substr($shuZ,0,strlen($shuZ)-2);
echo  $str;

var_dump($t);
$r = count($t);
var_dump($r);//数组长度
?>
拼接查询语句

 

 

View Code

全選和選刪按鈕  選中的放到數組裏面

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script src="../fenye/jquery-1.11.2.min.js"></script>
    </head>
    <body>
        <input type="checkbox" id="aaa" />
        <input type="checkbox" name="sss"  a='s' />1
        <input type="checkbox" name="sss"  a='m'/>2
        <input type="checkbox" name="sss"  a='n'/>3
        <input type="checkbox" name="sss"  a='k'/>4
    </body>
    <script>
    
        
        $("#aaa").click(function(){
        if($(this).prop("checked")==true)
        {
            $("[name='sss']").prop("checked",true);
        var chang = $("input[name='sss']:checked");
        var shuzu = new Array();
        for(var i =0;i<chang.length;i++)
        {
            shuzu[i]=chang.eq(i).attr("a");
        }
        alert(shuzu);
        
        }
        else
        {
            $("[name='sss']").prop("checked",false);
        }
            
        })
 
    </script>
</html>

  





posted @ 2017-05-02 10:18  get("新技能")  阅读(956)  评论(2编辑  收藏  举报