Is it possible to find out how many columns from a row were updated in a
single update SQL command?

For example:

$x = mysql_query("update users set un={$un},pw={$pw},ln={$ln},fn={$fn} where 
id={$id}");

And the function (something like mysql_affected_cols()) would return 0 if
everything stayed the same (like mysql_affected_rows() does), or if
something changed, the number of columns that were changed.

So if only the password and first name were changed, mysql_affected_cols()
would return 2.

>From PHP.net regarding mysql_affected_rows():
    When using UPDATE, MySQL will not update columns where the new value is
    the same as the old value. This creates the possiblity that
    mysql_affected_rows() may not actually equal the number of rows matched,
    only the number of rows that were literally affected by the query.

Any ideas?

Peter
---------------------------------------------------------------------------
Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED]                             http://www.purplecow.com/
---------------------------------------------------------------------------


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to