mysql_affected_cols() ??? or equivalent?

From: Date: Wed, 23 Oct 2002 19:13:48 +0000
Subject: mysql_affected_cols() ??? or equivalent?
Groups: php.db 
Request: Send a blank email to php-db+get-22623@lists.php.net to get a copy of this message
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 beckman@purplecow.com http://www.purplecow.com/ ---------------------------------------------------------------------------

« previous php.db (#22623) next »