|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-01-04 19:08 UTC] marc at phpmyadmin dot net
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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 22:00:01 2025 UTC |
Hi Andrey, here is my configuration, maybe the presence of PDO has an impact? ./configure --with-apxs2=/usr/local/apache2/bin/apxs \ --with-libdir=lib64 \ --disable-debug \ --enable-calendar \ --with-gd=shared \ --with-freetype-dir \ --with-mysql=shared,mysqlnd \ --with-mysqli=shared,mysqlnd \ --with-regex=php \ --with-png-dir=/usr/lib \ --with-zlib=shared \ --with-iconv=shared \ --enable-ftp \ --with-mcrypt=shared \ --with-bz2=shared \ --enable-zip \ --with-jpeg-dir=/usr/lib \ --enable-mbstring \ --without-sqlite \ --enable-dom \ --enable-json \ --enable-pdo=shared \ --with-pdo-mysql=shared,mysqlnd \ --without-pdo-sqlite \ --with-pear \ --enable-spl \ --enable-bcmath \ --with-curl=shared \ --with-ldap=shared,/usr \ --with-gettext=shared \ --with-snmp=shared \ --enable-sockets