mysqli_errno
    (PHP 5)
mysqli_errno
    (no version information, might be only in CVS)
mysqli->errno -- 直近の関数コールによるエラーコードを返す
説明
手続き型:
int 
mysqli_errno ( mysqli link )
オブジェクト指向型(プロパティ):
class 
mysqli { 
int errno
}
     mysqli_errno() 関数は、link
     が指すデータベースリンクに関する直近の MySQLi 関数コールのエラーコードを
     返します。エラーが発生しなかった場合は、この関数はゼロを返します。
    
注意: 
      クライアントのエラーメッセージ番号は MySQL の errmsg.h
      ヘッダファイルで、そしてサーバのエラーメッセージ番号は mysqld_error.h
      で定義されています。MySQL のソース配布の中には、エラーメッセージの
      完全なリストが Docs/mysqld_error.txt に含まれています。
     
返り値
     直近のコールが失敗した場合、エラーコードを返します。
     ゼロは、何もエラーが発生しなかったことを示します。
    
例
例 1. オブジェクト指向型 
<?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world");
  /* 接続状況をチェックします */ if (mysqli_connect_errno()) {     printf("Connect failed: %s\n", mysqli_connect_error());     exit(); }
  if (!$mysqli->query("SET a=1")) {     printf("Errorcode: %d\n", $mysqli->errno); }
  /* 接続を閉じます */ $mysqli->close(); ?>
 |  
  | 
例 2. 手続き型 
<?php $link = mysqli_connect("localhost", "my_user", "my_password", "world");
  /* 接続状況をチェックします */ if (mysqli_connect_errno()) {     printf("Connect failed: %s\n", mysqli_connect_error());     exit(); }
  if (!mysqli_query($link, "SET a=1")) {     printf("Errorcode: %d\n", mysqli_errno($link)); }
  /* 接続を閉じます */ mysqli_close($link); ?>
 |  
  | 
上の例の出力は以下となります。