Skip to content

The Lightweight PHP Database Framework to Accelerate Development.

Notifications You must be signed in to change notification settings

hassananayi/QuickDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

QuickDB - Database Framework

The Lightweight PHP Database Framework to Accelerate Development.


Introduction

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.

Installation

Simply include the QuickDB class in your project.

require_once 'path/to/QuickDB.php';

Usage

Initialize the Database Connection

Create an instance of the Database class by providing the necessary database credentials.

$db = new Database('host', 'username', 'password', 'database_name');

Methods

get

Fetch a single record from a table based on specific conditions.

$result = $db->get('table_name', "`column_name` = 'value'");
print_r($result);

select

Fetch multiple records from a table based on specific conditions.

$results = $db->select('table_name', "`column_name` = 'value'");
print_r($results);

update

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";

has

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

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

Delete records from a table based on specific conditions.

$success = $db->delete('table_name', "`column_name` = 'value'");
echo $success ? "Delete successful" : "Delete failed";

query

Execute a custom SQL query.

$sql = "SELECT * FROM table_name WHERE `column_name` = 'value'";
$results = $db->query($sql);
print_r($results);

Contributing

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

The Lightweight PHP Database Framework to Accelerate Development.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages