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
