#35537 [Opn->Fbk]: error in mysqli when updating a record

From: Date: Sat, 03 Dec 2005 22:25:36 +0000
Subject: #35537 [Opn->Fbk]: error in mysqli when updating a record
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89683@lists.php.net to get a copy of this message
ID: 35537 Updated by: tony2001@php.net Reported By: andrew dot holland at unn dot ac dot uk -Status: Open +Status: Feedback Bug Type: MySQLi related Operating System: windows xp PHP Version: 5.1.1 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-12-03 23:16:34] andrew dot holland at unn dot ac dot uk 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 this bug report at http://bugs.php.net/?id=35537&edit=1

« previous php.bugs (#89683) next »