|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-04-17 19:40 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 18:00:01 2025 UTC |
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!