note 14599 deleted from function.mysql-affected-rows by danbrown

From: Date: Tue, 28 Apr 2009 01:53:40 +0000
Subject: note 14599 deleted from function.mysql-affected-rows by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153888@lists.php.net to get a copy of this message
Note Submitter: peter at petermoulding dot NO_SPAM dot com ---- mysql_affected_rows() fails with some automatic updates. An example from the PHP Black Book is that of session records updated by automatic timestamps. When you maintain the session valid time via a timestamp and use some databases including MySQL, then update the session record, the automatic timestamp update will not count as an update in mysql_affected_rows(). You have to manually update the timestamp field. In MySQL that is achieved by setting the field to nulls. If your time field is named updated, you have to include set updated = null Other databases require appropriate tricks and you will have to test stored procedures in your database to see if their updates count in mysql_affected_rows().

« previous php.notes (#153888) next »