Edit report at http://bugs.php.net/bug.php?id=54190&edit=1

 ID:                 54190
 Updated by:         and...@php.net
 Reported by:        srwang at pixnet dot tw
 Summary:            mysqli->insert_id will return zero after
                     mysqli->get_warnings()
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            MySQLi related
 Operating System:   FreeBSD 7.3
 PHP Version:        5.3.5
-Assigned To:        
+Assigned To:        mysql
 Block user comment: N
 Private report:     N

 New Comment:

Works with libmysql, fails with mysqlnd.


Previous Comments:
------------------------------------------------------------------------
[2011-03-08 12:16:42] srwang at pixnet dot tw

Description:
------------
mysqli->insert_id will return zero after mysqli->get_warnings()

(In PHP 5.3.3, it is ok)

Test script:
---------------
$link = new mysqli('localhost', '', '', 'test');



$link->query("DROP TABLE `abcde`");

$link->query("CREATE TABLE abcde (`id` int(11) NOT NULL AUTO_INCREMENT,
`value` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`));");

$link->query("INSERT INTO abcde SET `id` = 0");



print_r($link->get_warnings());

echo $link->insert_id . "\n";

echo $link->query("SELECT LAST_INSERT_ID() AS `id`")->fetch_object()->id
. "\n";

Expected result:
----------------
mysqli_warning Object

(

    [message] => Field 'value' doesn't have a default value

    [sqlstate] => HY000

    [errno] => 1364

)

1

1

Actual result:
--------------
mysqli_warning Object

(

    [message] => Field 'value' doesn't have a default value

    [sqlstate] => HY000

    [errno] => 1364

)

0

1




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54190&edit=1

Reply via email to