开发者

getting number of rows deleted.?

开发者 https://www.devze.com 2023-03-29 22:05 出处:网络
i want after delete g开发者_开发百科etting number of rows deleted (How many of rows are deleted?). how is it?In your PHP code, you can retrieve the number of rows that were deleted by calling the mysq

i want after delete g开发者_开发百科etting number of rows deleted (How many of rows are deleted?). how is it?


In your PHP code, you can retrieve the number of rows that were deleted by calling the mysql_affected_rows() function and then return that value back to your Javascript.

Your PHP code might look similar to this:

...
$query = "DELETE FROM myTable WHERE some_column=something";
mysql_query($query);
$number_of_rows_deleted = mysql_affected_rows();
return $number_of_rows_deleted;
...


MAYBE you can count the checked checkboxes, on your JavaScript:

var total = $(':checkbox:checked', '.ser_form').size();
alert(total + ' rows deleted');

This way you're not counting the deleted rows from the database, only the count of checked checkboxes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号