This Database-Class is made to make handling databases (and database-operations) in PHP more easy.
##Other Databases
You can add support for any other database by using the file `db-blank.php`. I'm currently working to support mongodb.
## Examples
Examples can be found in `examples.php` or in the "Examples"-Section of this document.
## Initialize
First, you need to create an connection to your database:
```php
$db = new db('server', 'database', 'user', 'password', 'prefix');
```
The last pararmeter is optional. If provided, it will be put in front of each table name. This is useful if you have multiple applications in one database.
To use the methods, you need to first specify the table:
```php
$db->setCol('Blog');
```
## Provide Data
You can provide data either directly in the function (via pararmeters) or before via `$db->data` with the same options.
Parameters you provide directly in the function, are of higher priority as data provided via `$db->data`.
##get()
Get data with this function, it returns an array with the data.
All data is available via `$db->data`.
### Syntax
`$db->get($where = [], $link = 'AND')`
`$where`
An array to return specific data. If provided, only data which matches is returnend. Scheme: `['key' => 'value']`.
You can also provde the data via `$db->data['key'] = 'value'`.
`$link`
If you provide more than one key, you can choose via this pararmeter how to connect them, currently via `AND` or `OR`. Standard is `AND`.
To see it in action, take a look at `example.php` or the "Examples"-Section at the bottom of this document.
## insert()
Inserts data provided via `$db->data` or directly via the function.
Returns `true` on success, otherwise `false`.
### lastID()
After running `$db->insert()`, this function returns the ID of the lastly inserted Data.
### Syntax
`insert($args = [])`
`$args` An array which contains the data to insert. Scheme: `['Spalte' => 'Daten']`