note 33670 added to function.mysql-affected-rows
| From: | raistlin at oracolo dot com | Date: | Thu, 03 Jul 2003 14:38:29 +0000 |
| Subject: | note 33670 added to function.mysql-affected-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51458@lists.php.net to get a copy of this message | ||
| If you need to know the actual count of rows,
| even if some update changed nothing add a field
| count int(11) and add | one on every update, like in:
|
| mysql_query("update table set count=count+1, ...");
| if (mysql_affected_rows()==0) {
| mysql_query("insert into table ...");
| }
Better: add a field
flag tinyint(1) unsigned default '0'
on every update: "update table set flag=1-flag, ..."
----
Manual Page -- http://www.php.net/manual/en/function.mysql-affected-rows.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33670
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33670&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33670&report=yes