UPDATE {node} SET comment = 1 WHERE comment = 2 AND uid = %d AND type = '%s'

If there are no nodes of the given type by the specified user, db_affected_rows() returns 1. Doing the same query in PhpMyAdmin shows 0 rows.

Comments

dpearcefl’s picture

What database are you using?

NancyDru’s picture

MySql

dpearcefl’s picture

Here is my test code for your problem:


$results = db_query("UPDATE {node} SET comment = 1 WHERE comment = 2 AND uid = %d AND type = '%s'", 932, 'page');
$rows = db_affected_rows();

printf("Rows [%d]\n", $rows);

Which returns
Rows [0]

Can you provide your code?

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.