dbutil / crud
Project to create, read, update and delete data from an application.
v1.0.1
2022-03-10 11:50 UTC
Requires
- php: >=7.4.0
README
📄 Project Description
Project to create, read, update and delete data from an application.
⏬ Download Instruction
composer require dbutil/crud
📋 Examples of use
📦 Instantiating Class
$connection = new PDO( 'mysql:host=localhost;dbname=agent_atw', 'root', '123456' ); $crud = new Crud($connection);
🗃 Select Data
$selectUsers = "SELECT * FROM users WHERE ic_status = true ORDER BY dt_include DESC"; $results = $crud->selectData($selectUsers);
💾 Insert Data
$data = array( "nm_user" => "ElicX2", "nm_email" => "elic@gmail.com.br", "nm_password" => "123456" ); $table = "users"; $columnsThatWillBeFilled = array( "nm_user", "nm_email", "nm_password", ); $saved = $crud->saveData($data, $table, $columnsThatWillBeFilled);
📝 Update Data
$data = array( "nm_user" => "Lic", "nm_email" => "lic@gmail.com.br", ); $table = "users"; $where = "WHERE id_user = 4 AND ic_status = true"; $updated = $crud->updateData($data, $table, $where);
🗑️Delete Data
$table = "users"; $where = "WHERE id_user = 4 AND ic_status = true"; $deleted = $crud->deleteData($table, $where);