It should be noted that all reports made by this function, are sent through an exception named 'mysqli_sql_exception' instead of a normal PHP warning.
mysqli_report
(PHP 5)
mysqli_report — Habilita o deshabilita las funciones internas de reporte
Descripción
bool mysqli_report
( int $banderas
)
mysqli_report() es una poderosa función para mejorar tus consultas y código durante las etapas de desarrollo y prueba. Dependiendo de las banderas reporta errores de las llamadas a las funciones o las consultas que no usan un índice (o usa un mal índice).
| Nombre | Descripción |
|---|---|
| MYSQLI_REPORT_OFF | Deshabilita el reporteado |
| MYSQLI_REPORT_ERROR | Reporta errores de las llamadas a cualquier función |
| MYSQLI_REPORT_INDEX | Reporta si no se usa índice o si se usó un índice mal construido en una consulta |
| MYSQLI_REPORT_ALL | Fija todas las opciones (reporta todo) |
Valores retornados
Devuelve TRUE si todo se llevó a cabo correctamente, FALSE en caso de fallo.
Ver también
Ejemplos
Example #1 Estilo orientado a objetos
<?php
/* activate reporting */
mysqli_report(MYSQLI_REPORT_ALL);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* this query should report an error */
$result = $mysqli->query("SELECT Name FROM Nonexistingtable WHERE population > 50000");
/* this query should report a warning */
$result = $mysqli->query("SELECT Name FROM City WHERE population > 50000");
$result->close();
$mysqli->close();
?>
mysqli_report
Polarina
11-Nov-2007 12:08
11-Nov-2007 12:08
anthony dot parsons at manx dot net
06-Nov-2005 04:23
06-Nov-2005 04:23
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)
