Bug #71476 [Opn->Fbk]: Binding insert_id into prepared statement fails

From: Date: Wed, 10 May 2017 10:19:02 +0000
Subject: Bug #71476 [Opn->Fbk]: Binding insert_id into prepared statement fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209042@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71476&edit=1 ID: 71476 Updated by: fjanisze@php.net Reported by: j dot nord at ntlworld dot com Summary: Binding insert_id into prepared statement fails -Status: Open +Status: Feedback Type: Bug Package: MySQLi related Operating System: ubuntu4.14 PHP Version: 5.5.31 Block user comment: N Private report: N New Comment: I'm not able to reproduce your problem with the latest builds. I've been using a slightly modified script: . $mysqli = new mysqli('localhost', 'root', '', 'test'); $mysqli->autocommit(false); $stmt = $mysqli->prepare("INSERT INTO tab (id,name,age) VALUES(?,?,?)"); $plab = $mysqli->prepare("INSERT INTO labels (id) VALUES (?)"); $name = 'name'; $age = 10; $stmt->bind_param("isi", $mysqli->insert_id, $name ,$age); $stmt->execute(); $plab->bind_param("i", $db->insert_id); $plab->execute(); if( $plab->error != '') { print 'error: '.$plab->error.PHP_EOL; } . Can you verify again if on your environment this problem persist with recent releases? Thanks Previous Comments: ------------------------------------------------------------------------ [2016-01-28 10:08:19] j dot nord at ntlworld dot com Description: ------------ Using binding insert id into mysql prepared statement fails where a variable with the same value works perfectly. Test script: --------------- http://pastebin.com/umgSYhrz Expected result: ---------------- Code should echo: Able to commit Actual result: -------------- Code echoes: Error executing query: Column 'Barcode' cannot be null ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71476&edit=1

« previous php.bugs (#209042) next »