mysqli_warning_count
mysqli->warning_count
Returns the number of warnings from the last query for the given link
&reftitle.description;
Procedural style:
intmysqli_warning_count
mysqlilink
Object oriented style (property):
mysqli
intwarning_count
Returns the number of warnings from the last query in the connection.
For retrieving warning messages you can use the SQL command
SHOW WARNINGS [limit row_count].
&reftitle.parameters;
&mysqli.link.description;
&reftitle.returnvalues;
Number of warnings or zero if there are no warnings.
&reftitle.examples;
Object oriented style
query("CREATE TABLE myCity LIKE City");
/* a remarkable city in Wales */
$query = "INSERT INTO myCity (CountryCode, Name) VALUES('GBR',
'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')";
$mysqli->query($query);
if ($mysqli->warning_count) {
if ($result = $mysqli->query("SHOW WARNINGS")) {
$row = $result->fetch_row();
printf("%s (%d): %s\n", $row[0], $row[1], $row[2]);
$result->close();
}
}
/* close connection */
$mysqli->close();
?>
]]>
Procedural style
]]>
&example.outputs;
&reftitle.seealso;
mysqli_errno
mysqli_error
mysqli_sqlstate