mysqli_stmt_error
mysqli_stmt->error
Returns a string description for last statement error
&reftitle.description;
Procedural style:
stringmysqli_stmt_error
mysqli_stmtstmt
Object oriented style (property):
mysqli_stmt
stringerror
Returns a containing the error message for the most recently invoked
statement function that can succeed or fail.
&reftitle.parameters;
&mysqli.stmt.description;
&reftitle.returnvalues;
A string that describes the error. An empty string if no error occurred.
&reftitle.examples;
Object oriented style
query("CREATE TABLE myCountry LIKE Country");
$mysqli->query("INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = $mysqli->prepare($query)) {
/* drop table */
$mysqli->query("DROP TABLE myCountry");
/* execute query */
$stmt->execute();
printf("Error: %s.\n", $stmt->error);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
]]>
Procedural style
]]>
&example.outputs;
&reftitle.seealso;
mysqli_stmt_errno
mysqli_stmt_sqlstate