note 65118 added to function.mysql-info

From: Date: Mon, 24 Apr 2006 19:18:53 +0000
Subject: note 65118 added to function.mysql-info
Groups: php.notes 
Request: Send a blank email to php-notes+get-109593@lists.php.net to get a copy of this message
As a solution to the problem pointed in the post reffering to mysql_affected_rows() returning 0 when you are making an update query and the fields are not modified although the query is valid, i'm posting the following function. It is very simple and based on a previous post. function mysql_modified_rows () { $info_str = mysql_info(); $a_rows = mysql_affected_rows(); ereg("Rows matched: ([0-9]*)", $info_str, $r_matched); return ($a_rows < 1)?($r_matched[1]?$r_matched[1]:0):$a_rows; } Hope you'll find it usefull. ---- Server IP: 193.226.19.70 Probable Submitter: 81.196.196.133 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-info.php Edit -- http://master.php.net/note/edit/65118 Del: integrated -- http://master.php.net/note/delete/65118/integrated Del: useless -- http://master.php.net/note/delete/65118/useless Del: bad code -- http://master.php.net/note/delete/65118/bad+code Del: spam -- http://master.php.net/note/delete/65118/spam Del: non-english -- http://master.php.net/note/delete/65118/non-english Del: in docs -- http://master.php.net/note/delete/65118/in+docs Del: other reasons-- http://master.php.net/note/delete/65118 Reject -- http://master.php.net/note/reject/65118 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#109593) next »