mysqli_stmt_error
mysqli_stmt->error
Returns a string description for last statement error
Description
Procedural style:
stringmysqli_stmt_error
mysqli_stmtstmt
Object oriented style (property):
mysqli_stmt
stringerror
For the statement specified by stmt, mysqli_stmt_error
returns a containing the error message for the most recently invoked statement function that
can succeed or fail.
&reftitle.returnvalues;
A string that describes the error. An empty string if no error occurred.
&reftitle.seealso;
mysqli_stmt_errno&listendand;
mysqli_stmt_sqlstate.
&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;