mysql_affected_rows() returns the total rows affected by '1' query. therefor, since you are doing a 'foreach' loop, your last query affected 1 row.
in your case, you are running a query that will affect 1 row no matter what.
this code will get you the total deleted rows:
PHP Code:
<?
$i;
foreach ($del_row as $row_id) {
$result = mysql_query("DELETE FROM $db_table WHERE id = $row_id");
$i++;
}
echo $i. " deleted.\n<br><br>\n";
?>
now here's an example where mysql_affected_rows might work better.
PHP Code:
<?
// lets say $some_var appears in the field for 20 rows
$result=mysql_query("delete from table where field='$some_var'");
$deleted_rows=mysql_affected_rows();
echo $deleted_rows . " deleted.\n<br><br>\n";
?>
that's a cool function.. i didn't know about it till now =)