PHP mysqli: get_warnings() function
mysqli_get_warnings function / mysqli::get_warnings
The mysqli_get_warnings function / mysqli::get_warnings — get result of SHOW WARNINGS
Syntax:
Object oriented style
mysqli_warning mysqli::get_warnings ( void )
Procedural style
mysqli_warning mysqli_get_warnings ( mysqli $link )
Usage: Procedural style
mysqli_get_warnings ( void );
Parameter:
Name | Description | Required/Optional |
---|---|---|
connection | Specifies the MySQL connection to use. | Required |
Return value:
Returns an array with connection stats if success, FALSE otherwise.
Version: PHP 5 >= 5.1.0, PHP 7
Example of object oriented style:
<?php
$r = mysqli_query($db, "INSERT INTO blah SET z = '1'");
$j = mysqli_warning_count($db);
if ($j > 0) {
$e = mysqli_get_warnings($db);
for ($i = 0; $i < $j; $i++) {
var_dump($e);
$e->next();
}
}
?>
Example:
<?php
$r = mysqli_query($con, "INSERT INTO blah SET z = '1'");
$j = mysqli_warning_count($con);
if ($j > 0) {
$e = mysqli_get_warnings($con);
for ($i = 0; $i < $j; $i++) {
var_dump($e);
$e->next();
}
}
?>
See also
Previous: server_version
Next: info
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/php/function-reference/mysqli_get_warnings.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics