这是数据库循环取出来的ID
这是几个button
这是全选与反转代码
$(function(){
$("#checkedAll").click(function(){
$("[name=check]:checkbox").attr('checked',true);
});
$("#checkedRev").click(function(){
$("[name=check]:checkbox").each(function(){
this.checked=!this.checked;
});
});
});
但怎样实现批量删除??求高手指教!! 先谢啦!!
------解决方案--------------------
------解决方案--------------------
- PHP code
$post){
$pos = strpos($chk,"check");
if(!$pos === false)
$ids[] = $post;
}
if(count($ids) > 1)
$id = implode(",",$ids);
else
$id = implode($ids);
$sql = "DELETE FROM [table] WHERE id IN (".$id.")";
$result = mysql_query($sql,$conn);
if(!$result)
die("SQL: {$sql}
Error: " . mysql_error() );
if(mysql_affected_rows() > 0)
echo "";
else
echo "";
}
?>