mysql_affected_rows with DELETE?
Posted: Thu May 29, 2003 8:16 am
If this belongs in the php forum.... sorry twig 
Ok, im trying to find out how many rows are deleted, but im having problems
Heres the code ive got now:
I also tried mysql_num_rows. Now as far as i can tell from the mysql manual, even if there are no valid rows from the WHERE then it will return a number. Everything i try gives invalid result resource errors... Now i know i can suppress these errors with an @, but i need those numbers for the script
I know that the query's themselves work, because the rows that should be deleted are being deleted. Any ideas what is wrong? 
Ok, im trying to find out how many rows are deleted, but im having problems
Heres the code ive got now:
Code: Select all
<?php
$query3 = 'DELETE FROM bods WHERE owner = ' . $data['id'] . ' AND type = ' .
$HTTP_POST_VARS['bodtype'] . ' AND quality = ' .
$HTTP_POST_VARS['qual'] . ' AND number = ' .
$HTTP_POST_VARS['quant'] . ' AND part = 1 AND metal = ' .
$HTTP_POST_VARS['metal'] . ' LIMIT ' . $count;
$result3 = mysql_query($query3);
echo mysql_error() . $query3;
$count2 = mysql_affected_rows($result3);
?>