PHP code example of solodkiy / mysql-error-parser
1. Go to this page and download the library: Download solodkiy/mysql-error-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
solodkiy / mysql-error-parser example snippets
$connect = new \mysqli('localhost', 'root', '');
$result = $connect->query('select * from db.unknown_table');
if (!$result) {
$parser = new \Solodkiy\MysqlErrorsParser\PatternMatcher();
$structuredError = $parser->matchError($connect->errno, $connect->error);
var_dump(
$connect->error,
$structuredError->getTemplate(),
$structuredError->getParams()
);
}