#44766 [Opn->Fbk]: error in prepare but mysqli_error is empty
| From: | uw@php.net | Date: | Mon, 14 Jul 2008 16:50:44 +0000 |
| Subject: | #44766 [Opn->Fbk]: error in prepare but mysqli_error is empty | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126672@lists.php.net to get a copy of this message | ||
ID: 44766
Updated by: uw@php.net
Reported By: cap at unagon dot com
-Status: Open
+Status: Feedback
Bug Type: MySQLi related
Operating System: Redhat 3 Enterprise
PHP Version: 5.2.5
-Assigned To:
+Assigned To: uw
New Comment:
Can't repeat. You are not giving a repeatable code example. Please
provide an example that uses nothing but ext/mysqli API calls, for
example:
$mysqli = mysqli_init();
$mysqli->real_connect($host, $user, $passwd, $db, $port, $socket);
$mysqli->query('DROP TABLE IF EXISTS test');
$mysqli->query('CREATE TABLE test(id INT, label CHAR(2))');
$stmt = $mysqli->prepare('INSERT INTO test(id, label) VALUES (?, ?,
bogus)');
var_dump($stmt);
var_dump($mysqli->errno);
var_dump($mysqli->error);
$mysqli->close();
The above code works fine. It returns something like this:
bool(false)
int(1136)
string(47) "Column count doesn't match value count at row 1"
Also, please add the MySQL version to the bug report. Thanks!
Previous Comments:
------------------------------------------------------------------------
[2008-04-17 19:40:56] cap at unagon dot com
Description:
------------
if there is an obvious error in a prepare statement, the error is
recognized correctly but mysqli_error is the empty string
Reproduce code:
---------------
$stmt=DB::$mysqli->prepare ('INSERT INTO TYPES (TYPENAME,TYPESPEC)
VALUES (?,?,ppp)');
if (!$stmt) {throw new Exception ("Error: Prepare failed in
registerType: ".(DB::$mysqli->error));}
Expected result:
----------------
Expecting an exception to be thrwon with a text containing some
meaningful error description
Actual result:
--------------
Exception is thrown, but error is empty and errno is 0.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44766&edit=1