The Lightweight PHP Database Framework to Accelerate Development.
QuickDB is a lightweight PHP database framework designed to simplify and accelerate database interactions. It provides a set of easy-to-use methods to perform common database operations such as get
, select
, update
, has
, insert
, delete
, and query
.
Simply include the QuickDB class in your project.
require_once 'path/to/QuickDB.php';
Create an instance of the Database
class by providing the necessary database credentials.
$db = new Database('host', 'username', 'password', 'database_name');
Fetch a single record from a table based on specific conditions.
$result = $db->get('table_name', "`column_name` = 'value'");
print_r($result);
Fetch multiple records from a table based on specific conditions.
$results = $db->select('table_name', "`column_name` = 'value'");
print_r($results);
Update records in a table based on specific conditions.
$data = ['column1' => 'new_value1', 'column2' => 'new_value2'];
$success = $db->update('table_name', $data, "`column_name` = 'value'");
echo $success ? "Update successful" : "Update failed";
Check if records exist in a table based on specific conditions.
$exists = $db->has('table_name', "`column_name` = 'value'");
echo $exists ? "Record exists" : "Record does not exist";
Insert a new record into a table.
$data = ['column1' => 'value1', 'column2' => 'value2'];
$insert_id = $db->insert('table_name', $data);
echo "Inserted record ID: " . $insert_id;
Delete records from a table based on specific conditions.
$success = $db->delete('table_name', "`column_name` = 'value'");
echo $success ? "Delete successful" : "Delete failed";
Execute a custom SQL query.
$sql = "SELECT * FROM table_name WHERE `column_name` = 'value'";
$results = $db->query($sql);
print_r($results);
Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.