Be very careful using this function - it's a per-process setting.
If your server is set up to reuse a single PHP process for multiple requests, that means the last setting of this function in any script will affect all other scripts using mysqli.
To be safe always call <? mysqli_report(MYSQLI_REPORT_OFF) ?> at the end of a script. The CGI version of PHP is probably safe from this.
(Tested using PHP 5.0.5, Apache 2 SAPI module)
mysqli_report
(PHP 5 >= 5.2.0)
mysqli_report — 内部のレポート関数を有効あるいは無効にする
説明
bool mysqli_report ( int flags )mysqli_report() は、開発やテストのフェーズにおいて クエリの機能を向上させる強力な関数です。フラグの設定により、この関数は インデックスを使用しない(あるいは間違ったインデックスを使用している) mysqli 関数コールやクエリに対してエラーを報告します。
パラメータ
返り値
成功した場合に TRUE を、失敗した場合に FALSE を返します。
例
例 1440. オブジェクト指向型
<?php
/* レポート機能を有効にします */
mysqli_report(MYSQLI_REPORT_ALL);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* 接続状況をチェックします */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* このクエリはエラーを報告します */
$result = $mysqli->query("SELECT Name FROM Nonexistingtable WHERE population > 50000");
/* このクエリは警告を発生させます */
$result = $mysqli->query("SELECT Name FROM City WHERE population > 50000");
$result->close();
$mysqli->close();
?>
参考
| mysqli_debug() |
| mysqli_dump_debug_info() |
mysqli_report
anthony dot parsons at manx dot net
06-Nov-2005 12:23
06-Nov-2005 12:23