A class which makes easy database actions
Initiaze class with an array which contains database information.
require_once __DIR__ . '/Model.php';
$dbConfig = [
'dbHost' => 'localhost',
'dbName' => 'db',
'dbUser' => 'root',
'dbPassword' => 'root',
'charset' => 'utf8'
];
$model = new Model($dbConfig);
Get one row
$model->setTable('users')->select()->where('user_id','1');
$result = $model->get();
Get All Rows
$model->setTable('users');
$model->select();
$model->where('username','john', 'LIKE');
$result = $model->getAll();
$model->setTable('users')->insert([
'username' => 'User',
'user_email' => '[email protected]',
]);
$userId = $model->insertId();