views:

28

answers:

1

I have a DELETE query which deletes a record from a mysql db.

is there any way to make sure if the delete was performed or not?

I mean, for a query to FIND stuff you do

     $res=mysql_query($var);
     $nr=mysql_num_rows($res);

and you get nr of rows returned.

Is there any similiar method for deletion of records?

Thanks

+2  A: 

Use mysql_affected_rows(). It does not require the response as a parameter.

mysql_query('DELETE FROM whatever');
$num = mysql_affected_rows();

Also, I like PDO better than the classic mysql_ functions. Just saying.

Matchu