Hi in DatabaseManager, see Wiki!
- PHP 8.1
- MySQL or SQLite
$databaseManager = new \krzysztofzylka\DatabaseManager\DatabaseManager();
try {
$connect = \krzysztofzylka\DatabaseManager\DatabaseConnect::create()
->setType(\krzysztofzylka\DatabaseManager\Enum\DatabaseType::mysql)
->setDatabaseName('database')
->setUsername('username')
->setPassword('password');
$databaseManager->connect($connect);
} catch (\krzysztofzylka\DatabaseManager\Exception\DatabaseManagerException $exception) {
die($exception->getHiddenMessage());
}
$table = new \krzysztofzylka\DatabaseManager\Table('table name')
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
var_dump($table->query('sql'));
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
var_dump(
$table->find()
);
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
var_dump(
$table->findAll()
);
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
var_dump(
$table->findCount()
);
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
var_dump(
$table->findIsset()
);
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
$table->insert([
'column' => 'value'
])
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
$table->setId('element id')->update([
'column' => 'new value'
])
$table = new \krzysztofzylka\DatabaseManager\Table('table name');
$table->setId('element id')->updateValue('column', 'new value');
$conditions = [
'column' => 'value',
'column2' => 'value'
];
$conditions = [
'column' => 'value',
new \krzysztofzylka\DatabaseManager\Condition('column', '>', 5),
new \krzysztofzylka\DatabaseManager\Condition('column', 'LIKE', '%value%')
];