From:             andrew dot holland at unn dot ac dot uk
Operating system: windows xp
PHP version:      5.1.1
PHP Bug Type:     MySQLi related
Bug description:  error in mysqli when updating a record

Description:
------------
im getting an error when doing a second update on the same record in the
database.

mysqli_affected_rows() always returns 0 after the first update if you are
trying to update the same record.

ive used the mysql console to perform the same update and that works
fine.


Reproduce code:
---------------
$conn = mysqli_connect("localhost","root","****","****");

mysqli_autocommit($conn, FALSE);

$result = mysqli_query($conn,"update users set password = '$md5' where
username = '$myvar' ");
echo mysqli_affected_rows($conn)."<br />";

//check that no errors have occured or warnings
if (mysqli_warning_count($conn) == null )
{
        echo mysqli_affected_rows($conn)."<br />";

        if ( mysqli_affected_rows($conn) > 0)
        {
                echo "some data";       
                mysqli_commit ($conn);
        }
}
else
{
        echo "error";
        mysqli_rollback($conn);
}
mysqli_free_result($result);
mysqli_close($conn);
}


Expected result:
----------------
it should return > 0 for mysqli_affected_rows and run the following code

Actual result:
--------------
returns 0 if updating the same record

-- 
Edit bug report at http://bugs.php.net/?id=35537&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35537&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35537&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35537&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35537&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35537&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35537&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35537&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35537&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35537&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35537&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35537&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35537&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35537&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35537&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35537&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35537&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35537&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35537&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35537&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35537&r=mysqlcfg

Reply via email to