From:
Operating system: Linux
PHP version: 5.3.4
Package: MySQLi related
Bug Type: Bug
Bug description:Under mysqlnd, mysqli_affected_rows() returns 0
Description:
------------
In PHP 5.3.4 (also 5.3.3 and 5.3.2), connecting to MySQL 5.1.49 with mysqli
extension under mysqlnd, I always obtain 0 as the result of
mysqli_affected_rows() following an UPDATE that changed one row.
Works fine under PHP 5.2.14 + MySQL 5.1.49 client library.
Thanks,
Marc Delisle
Test script:
---------------
<?php
$link = mysqli_init();
mysqli_real_connect($link, 'localhost', 'user', 'password', 'db');
/*
* CREATE TABLE mytable (id int not null, myname varchar(50 not null))
engine=MyISAM;
* INSERT INTO mytable (id, myname) values(1, 'toto');
*/
mysqli_query($link, "update mytable set myname='Marc' where id=1");
printf("Affected rows (UPDATE): %d\n", mysqli_affected_rows($link));
mysqli_close($link);
?>
Expected result:
----------------
Affected rows (UPDATE): 1
Actual result:
--------------
Affected rows (UPDATE): 0
--
Edit bug report at http://bugs.php.net/bug.php?id=53651&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53651&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53651&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53651&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53651&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53651&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53651&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53651&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53651&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53651&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53651&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53651&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53651&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53651&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53651&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53651&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53651&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53651&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53651&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53651&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53651&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53651&r=mysqlcfg