---
name: "mysql_warning_count"
section: "3"
platform: "linux"
package: "mariadb"
version: "13.0.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mysql_warning_count"
---

# mysql\_warning\_count(3)

### Name

mysql\_warning\_count - Returns the number of warnings

### Synopsis

-

  ```
  #include <mysql.h>
  unsigned int mysql_warning_count(MYSQL * mysql);
  ```

### Description

Returns the number of warnings from the last executed query, or zero if there are no warnings.

### Parameter

- •

  `mysql` - a mysql handle, which was previously allocated by **[mysql\_init(3)](/mysql_init/3.md)** and connected by **[mysql\_real\_connect(3)](/mysql_real_connect/3.md)**.

### Notes

- •

  For retrieving warning messages you should use the SQL command `SHOW WARNINGS`.

- •

  If SQL\_MODE `TRADITIONAL` is enabled an error instead of warning will be returned. For detailed information check the server documentation.

### Return value

Returns the number of warnings

### See also

- •

  **[mysql\_error(3)](/mysql_error/3.md)**

- •

  **[mysql\_errno(3)](/mysql_errno/3.md)**
