https://github.com/holdoffhunger/mysql-errors-codes
Provide fuller error messaging for MySQL error messages.
https://github.com/holdoffhunger/mysql-errors-codes
mysql mysql-database mysql-error
Last synced: about 2 months ago
JSON representation
Provide fuller error messaging for MySQL error messages.
- Host: GitHub
- URL: https://github.com/holdoffhunger/mysql-errors-codes
- Owner: HoldOffHunger
- License: bsd-3-clause
- Created: 2018-07-12T23:35:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-05T04:04:06.000Z (about 6 years ago)
- Last Synced: 2025-03-23T15:28:24.727Z (about 1 year ago)
- Topics: mysql, mysql-database, mysql-error
- Language: PHP
- Size: 179 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# MySQL Error Codes
This project intends to provide fuller error messaging for MySQL error messages.
## Sample Use
### OLD Error Messaging
Normally, in PHP and MySQL, the only error information you can get is...
$db_link = new mysqli($this->hostname,$this->username,$this->password);
print($db_link->connect_errno . " : " . $db_link->connect_error);
This will only give output like...
13236 : Message: Newly created data directory SOMEDIRECTORY is unusable. You can safely remove it.
### NEW Error Messaging
But with MySQLErrorCodes...
$db_link = new mysqli($this->hostname,$this->username,$this->password);
print($db_link->connect_errno . " : " . $db_link->connect_error);
$mysql_error = new MySQLErrorCode();
$error_codes = $mysql_error->ErrorCodes();
print_r($error_codes[13236]);
And this will give the full output of...
13236 : Message: Newly created data directory SOMEDIRECTORY is unusable. You can safely remove it.
'13236' => [
'error_code' => '13236',
'internal_code' => 'ER_DATA_DIRECTORY_UNUSABLE',
'message_template' => 'Message: Newly created data directory %s is unusable. You can safely remove it.',
'sql_state' => 'HY000',
'version_information' => 'ER_DATA_DIRECTORY_UNUSABLE was added in 8.0.13.'
],