PHP 8.1.0 Released!

Die MySQLi Fehlerbehandlungs-Klasse

(PHP 5, PHP 7, PHP 8)

Einf├╝hrung

Die MySQLi Fehlerbehandlungs-Klasse

Klassenbeschreibung

class mysqli_sql_exception extends RuntimeException {
/* Eigenschaften */
protected string $sqlstate;
/* Geerbte Eigenschaften */
protected string $message;
protected int $code;
protected string $file;
protected int $line;
}

Eigenschaften

sqlstate

Der SQL-Status mit dem Fehler.

add a note add a note

User Contributed Notes 4 notes

up
9
fibrizo dot raziel at gmail dot com
6 years ago
<?php  mysqli_report(MYSQLI_REPORT_STRICT) ?>
was not enough for me to enable exception throwing. I had to write this:
<?php mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); ?>
up
-8
callforeach at gmail dot com
6 years ago
Please note that MYSQLI_REPORT_STRICT does not allow certain exceptions to be trapped. I find MYSQLI_REPORT_ALL to be more friendly since it allows me to trap all errors and handle them appropriately.
up
-19
polyanin at gmail dot com
7 years ago
$driver = new mysqli_driver();
        $driver->report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT;
up
-33
cnlyzy at qq dot com
4 years ago
<?php
mysqli_report
(MYSQLI_REPORT_STRICT);
try {
   
$mysqli = new mysqli('127.0.0.1','uesr','password','testDB');
    echo
'connect success';
} catch (
Exception $e) {
    echo
'ERROR:'.$e->getMessage();
}
To Top