Skip to content

AsmaaGamal30/AG-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dbwrapper

dbwrapper is a small php wrapper for mysql databases.

installation

install once with composer:

composer require asmaa_gamal/db-wrapper

then add this to your project:

require __DIR__ . '/vendor/autoload.php';
use Ag\DbWrapper\dbwrapper;
$db = new dbwrapper();

usage

/* connect to database */
$db = new dbwrapper('127.0.0.1', 'username', 'password', 'database', 3306);

/* insert/update/delete */
$id = $db->insert('tablename', ['col1' => 'foo'])->excute();
$db->update('tablename', ['col1' => 'bar'])->where(['id' => $id])->excute();
$db->delete('tablename')->where(['id' => $id])->excute();

/* select */
$db->select('tablename','columns')->getAll();
$db->select('tablename','columns')->getRow();
$db->select('tablename','columns')->where(['id' => $id])->getRow();

$db->select('tablename','columns')->where(['id' => $id])->andWhere(['id' => $id])->getRow();

$db->select('tablename','columns')->where(['id' => $id])->orWhere(['id' => $id])->getRow();

About

php wrapper for mysql database

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages