sparkling_tux wrote in php

DELETE query and not only

Do someone know what's wrong with the following code:
//deleting
if ($delete) {
        foreach ($record as $num) {
        $query=mysql_query ("DELETE FROM $table WHERE ID='$num'");
        }
        printf ("Records deleted: %d\n
", mysql_affected_rows($query));         }


As you probobly can see, I need it to print how many rows were deleted and it returns 0 even when I"m 100% sure several rows were deleted.