Bug #67053 [Opn->Fbk]: php-mysqlnd returns 0 value on insert
| From: | requinix@php.net | Date: | Thu, 10 Apr 2014 07:53:34 +0000 |
| Subject: | Bug #67053 [Opn->Fbk]: php-mysqlnd returns 0 value on insert | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185162@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67053&edit=1
ID: 67053
Updated by: requinix@php.net
Reported by: r dot bohnen at ips dot nl
Summary: php-mysqlnd returns 0 value on insert
-Status: Open
+Status: Feedback
Type: Bug
-Package: MySQL related
+Package: MySQLi related
Operating System: CentOS release 6.5 (Final)
PHP Version: 5.5.11
Block user comment: N
Private report: N
New Comment:
Need a new repro script, since the first one won't work and doesn't match your updated
description.
Previous Comments:
------------------------------------------------------------------------
[2014-04-10 07:48:14] r dot bohnen at ips dot nl
It's only at the second insert, the first is ok and as expected.
------------------------------------------------------------------------
[2014-04-10 07:42:34] r dot bohnen at ips dot nl
Description:
------------
When you insert and row within MySQL with the php-mysqlnd library you'll get an empty result
set as result.
Expected is; Inserted row id: {row number}
Current is; MySQL returned an empty result set (i.e. zero rows). (Query took 0.0002 sec)
Which means when you use:
mysqli_query("INSERT INTO demo (demoid,demoname,demovalue) VALUES
('','name','value')");
and you want to have the inserted id (with mysqli_insert_id();) you will get NULL or 0 response,
that's incorrect.
When we use an older php-mysql or php-mysqlnd library than 5.5.10 (now using 5.5.11 and tried with
5.5.10, but that's also broken) it works as expected.
Tested on multiple servers with same configuration.
Test script:
---------------
<?php
$query = mysqli_query("INSERT INTO demo (demoid,demoname,demovalue) VALUES
('','name','value')");
$result = mysqli_insert_id();
echo $result;
Expected result:
----------------
Returned ID
Actual result:
--------------
Null or 0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67053&edit=1