Commit a4ebb98b authored by Ettemlevest's avatar Ettemlevest

Adding error helper functions

parent 631decde
......@@ -19,6 +19,7 @@ MysqliDb -- Simple MySQLi wrapper and object mapper with prepared statements
**[Has method](#has-method)**
**[Helper Methods](#helper-methods)**
**[Transaction Helpers](#transaction-helpers)**
**[Error Helpers](#error-helpers)**
### Installation
To utilize this class, first import MysqliDb.php into your project, and require it.
......@@ -621,6 +622,17 @@ if (!$db->insert ('myTable', $insertData)) {
}
```
### Error helpers
After you executed a query you have options to check if there was an error. You can get the MySQL error string or the error code for the last executed query.
```php
$db->where('login', 'admin')->update('users', ['firstName' => 'Jack']);
if ($db->getLastErrno() === 0)
echo 'Update succesfull';
else
echo 'Update failed. Error: '. $db->getLastError();
```
### Query exectution time benchmarking
To track query execution time setTrace() function should be called.
```php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment