note 36240 added to function.mysql-affected-rows
| From: | sng2nara at rn2 dot php dot net | Date: | Thu, 02 Oct 2003 04:41:08 +0000 |
| Subject: | note 36240 added to function.mysql-affected-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57578@lists.php.net to get a copy of this message | ||
You can use following code for choosing update or insert.
mysql_query($update_sql);
preg_match(
"/^[^0-9]+([0-9]+)[^0-9]+([0-9]+)[^0-9]+([0-9]+)[^0-9]+$/",
mysql_info(),
$arr);
if( $arr[1] == 0 ) // a number of matched rows is 0
{...do insert query...}
else
{...nothing...}
----
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+36240
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36240&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36240&report=yes